fix(db): avoid live WAL TRUNCATE after incremental reclaim - #14244
Merged
diegosouzapw merged 1 commit intoSep 22, 2026
Merged
diegosouzapw merged 1 commit into
diegosouzapw merged 1 commit into
Conversation
Owner
|
Thanks @Bl0ck154 — merging via the release merge-train. Validated in local merge-train (mt-train10c) on the devbox @ train tip 4d841aa1c740bbaa03868dc0a403c62099a99a42 with the 72 sibling PRs of this batch: typecheck:core, file-size, complexity, cognitive-complexity, changelog-integrity green; changed-area node:test 831/831 (0 failing) and vitest 480/482 — the two reds are |
diegosouzapw
merged commit Sep 22, 2026
4aed815
into
diegosouzapw:release/v3.8.51
7 of 16 checks passed
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
reclaimFreedPages()still ends an incremental cleanup pass withwal_checkpoint(TRUNCATE)even though #14005 removed live TRUNCATE from WAL maintenance because changing the live WAL geometry can invalidate mapped handles and crash with SIGBUS.This switches the cleanup-path final checkpoint to
PASSIVE. The periodic WAL maintenance path already owns WAL high-water management, while PASSIVE is enough to fold reclaimed pages back without mutating the live WAL file geometry.Why
TRUNCATEis unsafe under concurrent handles.reclaimFreedPages.tspredates that change and still retained a liveTRUNCATEcall.Validation
npx tsx --test tests/unit/db/cleanup-reclaim-freed-pages.test.tspage_countshrinks after reclamation with a final PASSIVE checkpoint.