model-writtenrun 5544 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund reported that preserving database OIDs during pg_upgrade exposed stale SMgrRelation file descriptors: processes could read or write an old, unlinked file after its relfilenode was reused, and he proposed global barriers plus debugging checks #1.
- Robert Haas supported ProcSignalBarrier because ordinary invalidation messages were not processed promptly enough, and identified moving a database between tablespaces and back as another dangerous case; Thomas Munro and Andres agreed to establish the Windows barrier infrastructure first and extend it afterward #4 #5 #7.
- Andres demonstrated corruption from consecutive ALTER DATABASE SET TABLESPACE operations and submitted a primary-and-standby TAP test, deleted-file assertions, and an all-platform barrier fix using smgropen_cond() to restrict deferred writebacks #9 #10.
- Robert questioned the test's clarity and buildfarm stability and the suitability of scanning every process's open files; Andres explained the test's diagnostic steps, reported successful testing on four operating systems, and acknowledged that the process-wide debugging check was racy #11 #12 #14 #15.
- With no straightforward fix for released branches, Robert argued for fixing master first and considering a later backport of the barrier infrastructure rather than delaying the repair indefinitely #13.
- Thomas found that conditional smgr lookup could not prevent reopening files while the barrier merely closed kernel descriptors, so he supplied supplementary patches to destroy SMgrRelations and adapt RelationCopyStorage() to use fake relation objects safely across interrupts #17.
- Robert argued that invalidating object contents was safer than invalidating pointers throughout the codebase; Thomas consequently replaced object destruction with resource release and a counter that let writeback contexts discard requests accumulated across a barrier #18 #19 #20.
- After Robert questioned unnecessary loss of pending writebacks and pointed out that ordinary backends also maintained writeback contexts, Thomas moved the protection into md.c: release segment state while retaining SMgrRelations, and prohibit mdwriteback() from opening segments #21 #24 #25.
- The revised series also removed the platform-selection macro and restored Andres's test and assertions; Robert endorsed the design, but intermittent Windows failures prompted further investigation #25 #26 #27.
- Following off-list clues from Robert and Andres, Thomas identified a missing barrier during database file-copy redo; adding it resolved the Windows failure, and the next submission folded the TAP test into the global-barrier patch while leaving out the debugging assertions #28 #29.
- Thomas landed the segment-release change from #29 with minor naming and comment edits as b74e94dc27, and Andres's global-barrier change and test unchanged as e2f65f4255; the latter deferred backpatching because the required infrastructure was too new and invasive #30.
- The grison buildfarm animal then exposed a test race in which the standby used pg_prewarm before replaying CREATE EXTENSION; Thomas diagnosed it in #31 and added a replay wait plus a comment correction in a22652ebbc, later confirming the repair in #35.
- Concerned that wider barrier use could reveal processes that did not handle interrupts promptly, Thomas proposed logging the blocking PID every five seconds and separately offered a dummy SQL function for exercising barriers #30 #32.
- Robert endorsed the logging but questioned the dummy function's value; Thomas committed the logging attachment with conventional error-reporting wording as 0d3431497d and explicitly deferred the test function #33 #34.
- Two further buildfarm failures exposed test assumptions: chipmunk encountered an autovacuum worker that did not leave the template database quickly enough, while skink exhausted the script-wide timeout under Valgrind #35 #36.
- Thomas verified that aggressive autovacuum was unnecessary to reproduce corruption and proposed removing it while restarting the standard timeout for each query; Robert requested an explanatory comment, which Thomas added before committing 93759c665d #37 #38 #39.
- At the thread's end, the main fixes, logging, and both test repairs had landed, with buildfarm confirmation of the per-query timeout still awaited; deleted-file instrumentation and the dummy barrier function remained uncommitted, while general OID-wraparound protection had been left to separate work #25 #34 #39.