model-writtenrun 7032 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Sergey Zhuravlev reported LISTEN failing on PostgreSQL 13.2 because a transaction-status file was missing #1; Stepan Yankevych described recurring failures and subsequently reported that restarting the database cleared them #2 #3.
- Noah Misch explained that notifications retain sender transaction IDs whose CLOG records could be removed, and proposed limiting CLOG truncation using the queue’s oldest XID #4; Tom Lane explained how stale notifications affect incoming listeners and questioned the cost of finding that oldest XID, prompting Noah to suggest separately maintained state and a VACUUM NOTIFY operation #5 #6.
- After four years, Daniil Davydov reported that delayed queue-tail advancement could trigger the error even without long transactions, proposed advancing the tail during vacuum, and acknowledged that lagging listeners would still prevent this workaround from fully solving the problem #7.
- Alexandra Wang reproduced the failure on PostgreSQL 16.3 and master, traced it to a new listener processing stale notification XIDs, and clarified that disconnecting the previous listener was necessary for the referenced reproduction #8 #9.
- Daniil attached the interim tail-advancement patch, rejected scanning the queue in the frequently called ComputeXidHorizons(), and discussed maintaining an efficient minimum-XID structure as an unresolved fuller solution #10.
- Alexandra identified pg_notification_queue_usage() as an existing way to advance the tail manually #11; Daniil agreed but preferred automatic vacuum integration #12, and Alexandra ended this thread by moving the discussion to pgsql-hackers while the interim patch remained uncommitted here #13.
- The subsequent fix came from thread #52049, whose later submission #605182 supplied the freezing implementation committed by Heikki Linnakangas and credited to Joel Jacobson in 8eeb4a0f7c, superseding the previous attribution to this thread’s discussion.
- That commit freezes notification XIDs before CLOG truncation and adds an xid_wraparound regression test, omitting the source submission’s isolation-test changes and lightly simplifying its TAP test; it explicitly leaves a race involving readers’ local page copies for a subsequent fix 8eeb4a0f7c.