model-writtenrun 1169 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Anthonin Bonnefoy reported that an unflushed FPI_FOR_HINT continuation record could leave a logical walsender spinning and block shutdown, reproduced the problem on PostgreSQL 14 and development HEAD, and proposed flushing WAL before stopping walsenders in #1.
- Further investigation showed that XLogBackgroundFlush() could skip the final partial page because an aborted transaction without an assigned transaction ID had not advanced the asynchronous transaction LSN, so Anthonin moved the fix into RecordTransactionAbort() in #2 and supplied a reproduction script in #3.
- Fujii Masao reproduced the problem but questioned the normal-operation overhead of changing abort bookkeeping in #4; Anthonin added a zero-LSN optimization in #5 and presented both the abort-path and shutdown-flush alternatives in #6.
- Fujii argued for a minimal backpatchable fix and proposed flushing directly inside the walsender in #7; Anthonin adopted that approach in #8 and deferred the abort-path improvement to a separate discussion.
- Alexander Lakhin reported 100 successful test iterations with the walsender fix and pointed to an earlier unresolved discussion in #10; Anthonin explained in #11 that the older proposal's GetInsertRecPtr() still missed the partial page needed to resolve this hang.
- Fujii added a recovery guard and revised the commit message in #12, then committed that patch unchanged as 6eedb2a5fd, with backports through PostgreSQL 14, announcing the push in #13.
- Andres Freund identified a page-boundary flaw in the new flush target in #14: GetXLogInsertRecPtr() can point past a page header beyond the generated WAL.
- Anthonin reproduced the resulting flush errors and supplied a follow-up patch introducing GetXLogInsertEndRecPtr() in #15, also changing FinishSyncWorker(); Fujii approved the proposed fix in #16.
- After the helper landed independently, Fujii revised the patch to reuse it, added a comment explaining the boundary issue, and excluded the separate FinishSyncWorker() change in #17; Anthonin confirmed that the errors disappeared and that FinishSyncWorker() was not affected by this issue in #18.
- Fujii committed the narrowed patch from #17 unchanged as d927b4bd97, again with backports through PostgreSQL 14, and announced the push in #19.
- Michael Paquier requested regression coverage in #20, and Anthonin supplied a test using a deliberately sized logical WAL message to exercise both the shutdown hang and page-boundary error in #21.
- At the end of the thread, both production fixes had landed, while the test in #21 remained uncommitted; Anthonin noted its record-layout and alignment assumptions and reported unexplained WAL corruption observed during testing whose trigger he was still investigating.