model-writtenrun 2589 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Masahiko Sawada reported that disabling hot standby could leave logical slots valid after replaying a reduction in wal_level, causing an assertion failure after promotion, and proposed removing the hot-standby guard from WAL replay invalidation #1.
- Amit Kapila proposed rejecting standby startup when logical slots exist and hot_standby is disabled; Masahiko adopted that approach after confirming the exposed StandbyMode variable avoided an ABI change, then submitted a startup check and regression test #2 #3 #4 #5.
- Amit suggested placing the check in RestoreSlotFromDisk() to avoid another slot scan, while Bertrand Drouvot requested error wording consistent with existing slot checks; Masahiko incorporated both suggestions and added a standby-specific message and hint #6 #7 #8.
- Amit questioned whether backpatching the startup restriction would break existing promotion workflows; Masahiko acknowledged that compatibility concern but noted that inactive logical slots retain WAL and can contribute to primary bloat, while Bertrand favored consistent behavior across branches #9 #10 #12.
- Masahiko revisited the original replay-based fix and explained that adding a StandbyMode guard would miss archive recovery, but Amit remained concerned that InRecovery also covers crash recovery and recommended the final startup-check patch for all affected branches #14 #16 #17.
- Bertrand reaffirmed that choice, Masahiko agreed to backpatch through PostgreSQL 16, and the final patch landed unchanged apart from whitespace and rebasing as 48796a98d5; the thread ended with Masahiko confirming it was pushed #19 #20 #21.