Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGIHB-00Bqoi-F0 for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2025 14:44:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vGIHA-00ENlJ-Al for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2025 14:44:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGIHA-00ENl6-1X for pgsql-hackers@lists.postgresql.org; Tue, 04 Nov 2025 14:44:47 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vGIH7-005Q5L-0Y for pgsql-hackers@postgresql.org; Tue, 04 Nov 2025 14:44:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5A4EiSLO515741; Tue, 4 Nov 2025 09:44:28 -0500 From: Tom Lane To: Heikki Linnakangas cc: Joel Jacobson , pgsql-hackers Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue In-reply-to: <66213fee-00ff-4952-802d-c06454e521ac@iki.fi> References: <202510221548.tgggefdrlpo3@alvherre.pgsql> <149c402d-54c9-48dd-a730-2f5b958f2129@app.fastmail.com> <769bbdba-f86f-44ad-abad-f6ea4f74e3f2@iki.fi> <2297af80-dd5d-4fcc-815b-75bd64b00bf9@app.fastmail.com> <2759499.1761756503@sss.pgh.pa.us> <6ae4acd3-6c57-4271-bc24-634fd1b11d67@iki.fi> <68079c62-2fe9-4489-b68d-3b1b911ebd59@app.fastmail.com> <66213fee-00ff-4952-802d-c06454e521ac@iki.fi> Comments: In-reply-to Heikki Linnakangas message dated "Tue, 04 Nov 2025 14:09:58 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <515739.1762267468.1@sss.pgh.pa.us> Date: Tue, 04 Nov 2025 09:44:28 -0500 Message-ID: <515740.1762267468@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Heikki Linnakangas writes: > Fortunately that's easy to fix: We can move the IsListeningOn() check > after releasing the lock. See attached. > The elephant in the room of course is that a lookup in a linked list is > O(n) and it would be very straightforward to replace it with e.g. a hash > table. We should do that irrespective of this bug fix. But I'm inclined > to do it as a separate followup patch. There is a different patch series that's concerned with improving NOTIFY throughput [1]. I think this one should just focus on fixing the XID problem. regards, tom lane [1] https://commitfest.postgresql.org/patch/6078/