fix(session): use PASSIVE wal checkpoint on close and pre-VACUUM - #80346
Closed
webtecnica wants to merge 1 commit into
Closed
fix(session): use PASSIVE wal checkpoint on close and pre-VACUUM#80346webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
Contributor
Author
|
Closing in favor of #84277 by @lkz-de — the superset fix: converts all THREE remaining TRUNCATE sites (close, pre-VACUUM, and the post-optimize-storage checkpoint in hermes_state_search.py that this PR missed) plus production corruption evidence. Glad the original identification on #80255 carried; the fuller fix deserves the merge. Thanks for the credit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionDB.close()and the pre-VACUUM path still usedPRAGMA wal_checkpoint(TRUNCATE)— the same cross-linked b-tree corruption class fixed for the periodic path in #45383 (c2a3b9ce5, "use PASSIVE checkpoint for periodic WAL flush"). The shutdown path is the one most likely to be interrupted mid-checkpoint.Root Cause
The #45383 fix converted only
_try_wal_checkpoint()to PASSIVE. Two otherwal_checkpoint(TRUNCATE)call sites remained:close()(L2752) and the pre-VACUUM flush (L9041).Change
hermes_state.py: both remaining sites now usePRAGMA wal_checkpoint(PASSIVE); log messages and docstrings updated to match (zeroTRUNCATEremains — all 3 paths use PASSIVE).tests/test_wal_checkpoint_strategy.py:TestCloseUsesTruncate→TestCloseUsesPassive(spy asserts 1×PASSIVE, 0×TRUNCATE on close) + newTestVacuumUsesPassivecovering the pre-VACUUM site.tests/test_hermes_state.py:test_writable_close_retains_truncate_checkpoint→ assertspragma wal_checkpoint(passive).Verification
tests/test_wal_checkpoint_strategy.py+tests/test_hermes_state.py: 194 passed.Closes #80255