b+tree: index a node's entries through one accessor, and write up the occupancy work - #158
Open
psiha wants to merge 2 commits into
Open
b+tree: index a node's entries through one accessor, and write up the occupancy work#158psiha wants to merge 2 commits into
psiha wants to merge 2 commits into
Conversation
This was referenced Sep 9, 2026
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 10:34
ffc76fe to
684c220
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
from
September 9, 2026 10:34
a33f3b1 to
01ea915
Compare
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 10:39
684c220 to
58d1a41
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
from
September 9, 2026 10:39
01ea915 to
7256dc9
Compare
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 10:43
58d1a41 to
f1f4b93
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
from
September 9, 2026 10:45
7256dc9 to
0540117
Compare
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 10:49
f1f4b93 to
2a37547
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
from
September 9, 2026 10:49
0540117 to
f938b2b
Compare
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 10:56
2a37547 to
b0eebe7
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
from
September 9, 2026 10:56
f938b2b to
2951200
Compare
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 11:13
b0eebe7 to
29ec4e0
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
2 times, most recently
from
September 9, 2026 11:35
430f3a6 to
3dc55c7
Compare
Seventy-odd sites reached into node.keys[ i ] directly, which states in each of them that entry i of a node lives at offset i of its key array. That is true today and it is the only reason the tree cannot yet leave a gap at the front of a node. key_at( node, i ) is that statement, made once. It is still exactly node.keys[ i ] - no behavioural change, and it compiles to the same thing - but there is now a single place where "where does a node's first live entry sit" is answered, which is what a devector node needs and what the parallel value array of a map needs. The raw-array search helpers keep taking a bare Key const keys[]: their caller has already resolved the base, and they must stay callable on a span that is not a node at all (the bulk merge path passes source keys straight in).
What fill a b+tree actually reaches, what the classical variants do about it, what shipping systems actually do (read at source, not from secondary literature - no true B* among them), why this container is not becoming one, and which of LeanStore's node-level techniques transfer to a container with no buffer manager and no synchronisation.
psiha
force-pushed
the
bt/5-local-redistribution
branch
from
September 9, 2026 12:01
29ec4e0 to
262b915
Compare
psiha
force-pushed
the
bt/6-entry-accessor
branch
from
September 9, 2026 12:01
3dc55c7 to
b7dc27d
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.
Two commits.
1 — one entry accessor. Seventy-odd sites reached into
node.keys[ i ]directly, which states in each of them that entry i of a node lives at offset i of its key array. That is true today and it is the only reason the tree cannot yet leave a gap at the front of a node.key_at( node, i )is that statement, made once. It is still exactlynode.keys[ i ]— no behavioural change, same codegen — but there is now a single place answering "where does a node's first live entry sit", which is what a devector node needs and what a map's parallel value array needs.The raw-array search helpers keep taking a bare
Key const keys[]: their caller has already resolved the base, and they must stay callable on a span that is not a node at all (the bulk merge path passes source keys straight in).2 —
doc/b+tree_occupancy_and_variants.md. What fill a b+tree actually reaches, what the classical variants do about it, and what shipping systems actually do — read at source rather than taken from secondary literature:balance_nonrootredistributes over up to three siblings n→n+1 and its delete-side floor is ~1/3, the opposite of B*; Apple's HFS docs say "B*-tree" butInsertLevelrotates into the left sibling only and then splits 1→2. PostgreSQL, InnoDB, LMDB, Berkeley DB and WiredTiger all split 1→2 with no sibling redistribution at all.min_values = ceil( max / 2 )is not a constant that can be raised (see b+tree: state the bounds a node actually has #155) and that the one careful measurement of B* puts it at −15% space for +31% cycles, beaten on both axes by deferred compaction.Stacked on #157.