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

Started by Tom Laneabout 1 month ago1 messagescommitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

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: /messages/by-id/CAGRkXqQ1bmVwBw2CXiyZeWWP=XkHPXLPcQ7BSg2Q5JKSvDAnTA@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1db74dc0ec7115075a031d3537542e1e1caba799

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