Skip to content

Guard B-tree splits against node exhaustion - #238

Open
Qian-Cheng-nju wants to merge 1 commit into
tlaplus:masterfrom
Qian-Cheng-nju:btree-free-nodes
Open

Qian-Cheng-nju wants to merge 1 commit into
tlaplus:masterfrom
Qian-Cheng-nju:btree-free-nodes

Conversation

@Qian-Cheng-nju

Copy link
Copy Markdown

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. SplitRootLeaf still tries to choose two distinct free nodes, and TLC stops at the second CHOOSE.

FreeNodesRemain does not catch this case: one node is still free. The same issue applies to SplitRootInner; an ordinary SplitLeaf needs 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.cfg checks all five safety invariants with a two-node pool. It completes with 202 distinct states. The existing MCbtree.cfg also passes with the same 374,727 distinct states; its generated-state count is updated for the new existential guards.

This leaves the missing SplitInner action in #234 as a separate issue.

Signed-off-by: Qian-Cheng-nju <Qian-Cheng-nju@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant