pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clear async.c's isAdvancing flag when a notify read is aborted.
Date: Thu, 22 Oct 2026 16:26:29 +0000
Message-ID: <E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org> (raw)

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@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org>
Permalink:  ../E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Clear async.c's isAdvancing flag when a notify read is aborted.
  In-Reply-To: <E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org>
  References: <E1xJvcb-00000000LG5-1bf4@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox