model-writtenrun 1827 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Melanie Plageman reported that XLogNeedsFlush() could return true immediately after XLogFlush() during an end-of-recovery checkpoint, demonstrated the inconsistency with recovery test 015_promotion_pages, and proposed checking whether WAL insertion was allowed in #1.
- Dilip Kumar and Michael Paquier clarified the recovery-state distinctions, while Melanie explained that her batched-write work needed XLogNeedsFlush() to work reliably in any backend that might flush WAL; the discussion converged on selecting the flush pointer whenever WAL insertion is allowed #2 #6 #9 #10 #11.
- Michael separated three possible improvements—aligning the WAL-insertion test, reordering recovery checks, and simplifying recovery-state detection—and recommended an assertion inside XLogFlush() to keep the two functions consistent #11 #12.
- Dilip's first attachment passed check-world but called XLogNeedsFlush() on XLogFlush()'s cheap exit path; Michael objected to the overhead, and Dilip replaced that call with an end-of-function assertion #14 #15 #16.
- Jeff Davis confirmed that existing callers did not expose a live bug and requested comments explaining the end-of-recovery exception; Dilip incorporated that feedback, and Jeff approved the revision #18 #19 #20.
- Melanie questioned the assertion's coverage, then accepted that it protected against divergence between the two functions and requested clearer comments; Michael considered broader crash-recovery support but kept the patch focused because there was no concrete additional use case #22 #23 #24.
- Dilip explained why background writes should not advance the minimum recovery point beyond replayed WAL, and Michael clarified archive-versus-streaming transitions and that restart points can occur during crash recovery #25 #26.
- Michael supplied a comment revision and verified that restoring the old recovery test made recovery test 015 fail; Chao Li and Melanie then requested clearer wording, which Dilip incorporated into the final attachment #27 #28 #29 #31.
- Michael committed deb208df45 from #31 with editorial changes, crediting Melanie as author and Dilip as co-author, then reopened the separate question of making the recovery checks follow the same order #32.
- Melanie submitted a separate check-reordering patch and also proposed an inline GetRecoveryState() simplification; Michael accepted the reordering approach but asked to handle the more invasive recovery-state change separately, including its consequences for non-startup processes and redundant checks #36 #37.
- Michael applied the attached reordering patch from #36 unchanged as bb68cde413 and invited further patches for the remaining work #38.
- Both attached changes had landed by the end of the thread, but the GetRecoveryState() simplification remained unresolved: Melanie still questioned recovery when the minimum recovery point requires archived or streamed WAL, and whether the later invalid-LSN check could safely be removed #39.