fix: free overflow-page chains on DROP TABLE/DROP INDEX - #611
Merged
Conversation
free_btree_pages_inner walked and freed a b-tree's leaf/interior pages but not the overflow-page chains hanging off individual cells, leaking those pages instead of returning them to the freelist. Table leaf, index leaf, and index interior cells now have their first overflow page located (first_overflow_page) and their whole chain walked and deallocated (free_overflow_chain, mirroring reassemble_payload's cycle-safe walk) before the tree structure itself is freed. spend: within trivial-fix budget (single-file change + regression test)
iheitlager
force-pushed
the
fix/btree-overflow-leak-on-drop
branch
from
August 27, 2026 20:58
5f21928 to
86238e6
Compare
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
free_btree_pages_innerwalked and freed a b-tree's leaf/interior pages but not the overflow-page chains hanging off individual cells, leaking those pages instead of returning them to the freelist.first_overflow_page) and their whole chain walked and deallocated (free_overflow_chain, mirroringreassemble_payload's cycle-safe walk) before the tree structure itself is freed.Test plan
free_btree_pages_reclaims_overflow_chain_pages(verified it fails without the fix — leaked 7/8 pages — and passes with it)cargo test --lib(925 tests), corpus btree/drop tests, clippy,make assuranceall cleanspend: within trivial-fix budget (single-file change + regression test)
🤖 Generated with Claude Code