model-writtenrun 7306 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Sami Imseih reported a PostgreSQL 13.5 promotion PANIC caused by stale missingContrecPtr and proposed guarding overwrite-record creation against an already-replayed LSN, with a reproducing TAP test #1.
- Álvaro Herrera confirmed that the test failed without the fix and passed with it, then corrected the accidentally nested test attachment #2.
- Kyotaro Horiguchi argued that the recovery state should be corrected earlier and proposed clearing abortedRecPtr and missingContrecPtr while replaying XLOG_OVERWRITE_CONTRECORD #4 #5.
- After adding diagnostic logging to explain the failure, Sami adopted Kyotaro's reset approach and replaced the separate test with a promotion check in the existing overwrite-contrecord test #6 #7.
- Sami supplied stable-branch ports through PostgreSQL 10, and Álvaro committed the fix with the test simplified to the standard promote helper as 9d92582abf #8 #9.
- In May, Sami reported another promotion PANIC on PostgreSQL 13.7 despite the committed fix, with no log evidence that an overwrite-contrecord had been replayed to clear the stale pointers #10.
- Sami supplied diagnostic patches and proposed checking StandbyModeRequested instead of StandbyMode because a future standby initially performs crash recovery with StandbyMode false; his development-branch reproducer deliberately disabled the March reset #14 #16.
- John Hsu reported several days of successful workload and failover testing with Sami's proposed condition, while Michael Paquier requested a reproducer that retained the existing pointer-reset fix #17 #18.
- Kyotaro rejected disabling the existing fix as evidence of a remaining bug and supplied an archive-recovery reproducer plus a tentative fix that cleared stale pointers after reading a complete record #19.
- Robert Haas argued that overwrite records should depend on the final WAL record boundary, prompting Kyotaro to replace the global-pointer bookkeeping with a snapshot of WAL-reader state before FinishWalRecovery() rereads the last record #20 #21.
- Michael questioned whether that rewrite tested the actual standby-mode failure, while Robert cautioned against backpatching a broader removal of the final-record reread #22 #23.
- Kyotaro discovered that his first reproducer disabled standby mode, revised it to exercise explicit standby promotion, and provided detailed logging to investigate Sami's repeated-failover environment #27.
- After a testing delay, Sami backported the logging to PostgreSQL 13.7 and reproduced stale pointers surviving through recovery into a later promotion PANIC #30 #31.
- Further log analysis established that the output spanned multiple server runs, but Kyotaro still sought the exact restart procedure and explanation for the apparently inconsistent WAL stream #32 #33 #34.
- Robert ultimately committed Dilip Kumar's different fix from #514235 in thread #46464 as 6672d79139, preventing overwrite-contrecord creation when archive recovery will switch timelines by checking ArchiveRecoveryRequested and asserting timeline consistency; this thread's exploratory pointer-state rewrite and diagnostic tests were not included.
- Robert linked the August commit back to this thread, and Sami's final message confirmed that it fixed the reported issue, leaving both bug rounds resolved, with the second fix originating in thread #46464 #36 #37.