model-writtenrun 6274 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Marcin Krupowicz reported that PostgreSQL 13.3 retained hundreds of gigabytes of WAL after a replication slot exceeded max_slot_wal_keep_size, even across repeated checkpoints, until PostgreSQL restarted #1.
- Kyotaro Horiguchi initially explained normal checkpoint-related overshoot #2, but Marcin clarified that manual checkpoints also failed to clear the files #3, and Jeff Janes confirmed that retaining a lost slot caused the problem while dropping it allowed cleanup #4.
- Kyotaro traced the problem to a stale replication-slot minimum LSN and supplied a proof of concept recalculating the WAL-removal horizon #5, then added conditional invalidation reporting and a regression test #6.
- Alvaro Herrera confirmed that the fix would also be backpatched to PostgreSQL 13 #8, and Jeff reported successful testing and suggested clearer invalidation terminology #9.
- Alvaro moved resource-limit recalculation into slot.c, added minimum-Xmin recalculation, and moved the invalidation flag assignment into the actual invalidation block #10; he then questioned the checkpoint-side recalculation #11 and posted a smaller version that passed the test without it #12.
- Kyotaro showed that an extra checkpoint concealed the smaller version's defect and that KeepLogSeg alone could not advance the horizon; his revision restored XLByteToSeg and checkpoint-side recalculation while replacing the misleading test synchronization #13, which Alvaro accepted #14.
- Alvaro committed that revision as ead9e51e82, with explanatory comments and formatting edits, and announced the push #15.
- Alvaro soon observed failures because the test could see an invalidated slot before its warning and cleanup had completed #16; his follow-up waited for the warning instead #17 and landed as 8589299e03 with a revised assertion description.
- Kyotaro identified another timing gap because WAL removal follows the invalidation warning, so he added a wait for the checkpoint-completion log entry #18; Alvaro checked the failure logs and committed it with wording changes as 0d2cb6b2bb, explaining his verification in #19.
- Tom Lane reported that the test still failed on the buildfarm and questioned its synchronization between WAL cleanup and slot creation #21.
- Kyotaro determined that the completion-log check could match an earlier checkpoint #22, then supplied explicit checkpoints and a temporary max_wal_size increase to control the timing #23, resending the identical code with corrected commit-message wording #24.
- Alvaro committed the final test fix as ce197e91d0, polishing comments and correcting an outdated xlog.c comment; he cautioned that the rare failure required further observation #25.
- All submitted fixes had landed by the thread's end, and Alvaro reported no further buildfarm failures as of August 2, while the longer observation period remained outstanding #27.