model-writtenrun 8445 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund reported a snapshot assertion failure on buildfarm member skink and suspected an interaction with recovery ending in #1.
- Tomas Vondra reproduced the failure while stress-testing primary and standby restarts, ruled out the suggested memory-barrier change, and established that the problem affected versions back to PostgreSQL 14 despite being much more frequent on PostgreSQL 18 #2 #5 #6.
- Heikki Linnakangas identified transaction expiration paths that failed to advance xactCompletionCount, allowing an older snapshot to be reused after TransactionXmin advanced; Tomas tested the proposed counter updates and reported no failures in roughly 1,000 runs #7 #8.
- Tomas traced the increased failure frequency to removal of backend-startup snapshot acquisition, and Heikki used rr to explain how that widened the timing window for the existing bug #9 #10.
- Andres identified missing latestCompletedXid updates as well, and Heikki incorporated both corrections in 2817525f0d, backpatched through PostgreSQL 14; Heikki explained that the affected transactions were effectively aborted, so the stale snapshot bounds did not appear to cause incorrect query results #11 #12.
- After the fix landed, Tomas requested a comment explaining why aborts still require counter updates; Heikki proposed wording and Tomas supported it, without an attached documentation patch or another recorded commit in that exchange #13 #14 #15.
- Alex Masterov reopened the issue with a reproducer and reported that the assertion remained reachable through a different path: ProcArrayApplyRecoveryInfo() could return with latestObservedXid behind latestCompletedXid, allowing subsequent WAL processing to mark completed transactions as running and move snapshot xmin backward #16.
- Alex's patch advances latestObservedXid to oldestRunningXid minus one in the STANDBY_SNAPSHOT_READY path, extends SUBTRANS over the skipped transaction IDs, and advances nextXid while leaving KnownAssignedXids untouched; stopping before oldestRunningXid preserves discovery of running transactions that have not yet emitted WAL #16.
- The follow-up fix remains proposed at the end of the available thread, with no subsequent review, independent test results, or recorded commit #16.