Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Joel Jacobson <joel@compiler.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-04T14:44:28Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Clear 'xid' in dummy async notify entries written to fill up pages

  2. Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY

  3. Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY

  4. Escalate ERRORs during async notify processing to FATAL

  5. Limit the size of TID lists during parallel GIN build

Heikki Linnakangas <hlinnaka@iki.fi> 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/