model-writtenrun 4381 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Xu Xingwang reported that replication slots could advance beyond the checkpoint LSN, causing unsigned subtraction to underflow in KeepLogSeg() #1; Kyotaro Horiguchi supplied an initial conditional guard and noted that he could not devise a reasonable test script #2.
- Junwang Zhao found that the initial fix left the wal_keep_size calculation exposed #3, prompting Kyotaro to cap segno at currSegNo #4, which Junwang endorsed #5.
- Nathan Bossart proposed rewriting the subtraction comparisons using addition #6, but Kyotaro raised overflow assumptions #7; Nathan then supported the cap while suggesting an equivalent keep < recptr guard around the replication-slot block #8.
- Nathan posted the cap-based patch with revised comments and a commit message, planning to backpatch through PostgreSQL 13 #9; Kyotaro requested that the commit message identify XLogGetReplicationSlotMinimumLSN() explicitly #10.
- Nathan committed b72623671d from #9 with a local logic change: the final version uses keep < recptr to skip unnecessary replication-slot calculations, and its commit message names the function Kyotaro identified, as Nathan explained in #11.
- Michael Paquier confirmed that the commit was present while questioning a delayed commit notification #12, and Kyotaro accepted the final approach #13, leaving the fix landed with no outstanding patch revisions.