pgsql: Clear async.c's isAdvancing flag when a notify read is aborted.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Clear async.c's isAdvancing flag when a notify read is aborted.
Date: 2026-10-22 16:26:29
Message-ID: E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Clear async.c's isAdvancing flag when a notify read is aborted.

asyncQueueReadAllNotifications() sets our isAdvancing flag and clears
it when done. But if we error out in between, for example on a
cancel while waiting for a safe snapshot, the flag stays set and
SignalBackends() never advances or wakes us again, so the queue tail
stops moving. To fix, clear the flag in AtAbort_Notify().
(We need not worry about this in subtransaction abort, since
asyncQueueReadAllNotifications() is only called in top-level
transactions.)

Author: shihao zhong <zhong950419(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAGRkXqQ1bmVwBw2CXiyZeWWP=XkHPXLPcQ7BSg2Q5JKSvDAnTA@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/871dee0ccbe292cf4c2874aa7b460d242262d242

Modified Files
--------------
src/backend/commands/async.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-10-22 17:19:52 pgsql: Qualify unqualified names in CREATE SCHEMA elements again.
Previous Message Fujii Masao 2026-10-22 08:36:43 pgsql: Use pg_parse_lsn() for timeline history switchpoints