Repository navigation
Guard B-tree splits against node exhaustion - #238
Open
Qian-Cheng-nju wants to merge 1 commit into
Open
Qian-Cheng-nju wants to merge 1 commit into
Qian-Cheng-nju wants to merge 1 commit into
Conversation
Signed-off-by: Qian-Cheng-nju <Qian-Cheng-nju@users.noreply.github.com>
Qian-Cheng-nju
force-pushed
the
btree-free-nodes
branch
from
October 20, 2026 17:24
5b420bf to
f217f43
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.
With
MaxOccupancy = 2, two nodes and keys{1,2,3}, inserting two keys fills the root. The next insertion needs a root split, but only one free node remains.SplitRootLeafstill tries to choose two distinct free nodes, and TLC stops at the secondCHOOSE.FreeNodesRemaindoes not catch this case: one node is still free. The same issue applies toSplitRootInner; an ordinarySplitLeafneeds one free node.This adds guards for the number of nodes each split needs. If the pool is too small, the split blocks. Would that be the right allocation policy here, or would you prefer to make sufficient space an explicit assumption?
The new
MCbtreeExhaustion.cfgchecks all five safety invariants with a two-node pool. It completes with 202 distinct states. The existingMCbtree.cfgalso passes with the same 374,727 distinct states; its generated-state count is updated for the new existential guards.This leaves the missing
SplitInneraction in #234 as a separate issue.