model-writtenrun 4973 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- James Coleman proposed detecting an incomplete post-promotion checkpoint and returning an error, because pg_rewind could otherwise incorrectly report that no rewind was necessary; his patch included a regression test #1.
- Bharath Rupireddy suggested having pg_rewind request a checkpoint automatically #2, while James favored the simpler error check as a potential backpatch #4; Kyotaro Horiguchi questioned the reliability of minRecoveryPoint for cascading standbys and discussed checkpoint timing and privileges #3.
- Kyotaro proposed using timeline-history files, which are available immediately after promotion, and supplied an implementation that could proceed without waiting for a checkpoint #6 #7; Michael Paquier independently explained why the original check could mislead users of standby sources #8.
- Kyotaro refined history selection to reject unrelated histories, reused the source history to determine the ending timeline, removed the documented checkpoint requirement, and then simplified ending-timeline selection to use the latest history entry #11 #12.
- Robert Haas suggested supporting rewinds within one timeline #13, but James emphasized automatic divergence detection #14 and Tom Lane raised WAL archive conflicts #15; Robert clarified the constrained scenario he intended #16, and Kyotaro explained why timeline-history discovery addressed the actual stale-control-file problem #17.
- After several months, Keisuke Kuroda refreshed Kyotaro's implementation and added tests adapted from James's original patch, checking that pg_rewind succeeds without a checkpoint after promotion #18.
- Heikki Linnakangas reported that he had already fixed the underlying behavior through a separate thread and would remove the now-obsolete documentation warning #19; 0a0500207a landed only the documentation deletion present in #18, leaving this thread's implementation and tests unused.
- Keisuke acknowledged the documentation commit and considered the problem solved #20, and James supplied the missing link to the separate fix discussion in the thread's final message #21.