model-writtenrun 7655 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Soumyadeep Chakraborty reported that PITR promotion with prepared transactions could overwrite WAL on the old timeline and make a later restart fail, and submitted a fix refreshing ThisTimeLineID after two-phase checkpoint processing on behalf of himself, Kevin Yeap and Jimmy Yih #1.
- Kyotaro Horiguchi reproduced the bug and proposed restoring the timeline from the checkpoint structure #2, but Heikki Linnakangas identified that LogStandbySnapshot() could already have written WAL with the wrong timeline before that restoration #3.
- Fujii Masao suggested preventing the shared WAL reader from leaving ThisTimeLineID changed #4, and Soumyadeep supplied two alternatives: save and restore the global inside the reader, or pass a separate timeline argument through XLogReadDetermineTimeline() #5.
- Kyotaro argued that the reader's timeline updates were part of its intended behavior and supplied a narrower save-and-restore fix in XlogReadTwoPhaseData() #6; Fujii questioned which callers actually required those updates #8, and Kyotaro clarified that preserving the reader's contract was his concern #10.
- After Michael Paquier requested a dedicated recovery TAP test #7, Soumyadeep supplied one that passed with Kyotaro's local fix #12, then replaced its fixed sleep with polling for archival and promotion #13.
- Michael initially favored separating the replay timeline from ThisTimeLineID and combined a refined explicit-argument implementation with the regression test, reporting successful reproduction testing and no observed cascading-replication breakage #14.
- Kyotaro raised concerns about logical-decoding users and the reader's documented behavior #15; Michael acknowledged that the API was public #16, then examined its history and concluded that changing the callback could surprise external users or future standby logical decoding work #17.
- Michael returned to the local XlogReadTwoPhaseData() fix, restoring the saved timeline immediately after reading the record and retaining the regression test, while deferring broader removal of reader dependencies on ThisTimeLineID to separate development work #18.
- Michael committed 595b9cba2a from #18 with light comment and test changes, replacing potentially unstable WAL-file comparison with a checkpoint and crash-restart check, and announced backpatches through PostgreSQL 10 #19.
- Months later, Tom Lane reported a buildfarm assertion failure triggered by the new test #20, found similar failures suggesting a transient invalid snapshot during prepared-transaction recovery #21, and linked the problem to an existing separate discussion #22; the timeline fix remained committed, with no additional fix or revert posted in this thread.