impr(store_volatile): index group children in a separate ETS table#879
Closed
shyba wants to merge 2 commits into
Closed
impr(store_volatile): index group children in a separate ETS table#879shyba wants to merge 2 commits into
shyba wants to merge 2 commits into
Conversation
Author
|
Back to draft for 2 reasons:
|
Author
|
Replaced by #887 |
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.
What
Replaces the volatile store's in-band child set with a dedicated
children index table, adding an overwrite fast path to
write/3andmake_link/3.Why
hb_store_volatiletracked group membership by storing asets:set()of children inside the main table's
{group, Set}row. Every writewalked the parent chain and called
sets:add_element/2, which copiesthe ordset.
How
bag-typed, keyed by parentpath, each row
{Parent, ChildName}. Bag semantics collapseduplicate rows automatically.
{group, true}. Allmembership lives in the index table.
list/2on a group path becomes a singleets:lookup/2on theindex — O(family-size), no scan.
write/3andmake_link/3branch once on the existing entry:{group, true}→ delete the index rows for that pathbefore overwriting, so the new raw/link value doesn't leave
stale children visible on later recreate
indexed when the key was first created)
reset/1clears both tables.No change to the store's external semantics.
list/2,type/2,make_group/2,read/2,resolve/2behavior is preserved.Measured impact
Direct writes (1 KiB value, single parent):
End-to-end
hb_cache:writeon volatile, 200 1 KiB committedmessages, 10-run median:
For comparison,
hb_store_lmdbon the same workload: ~1800 msgs/s.Tests
New coverage:
list_test,list_dedup_test,list_with_link_test— grouplisting and dedup invariants.
overwrite_link_to_raw_test— raw value replacing a link.overwrite_group_to_raw_test— raw value replacing a groupmarker; asserts index rows for the path are gone before recreate.
overwrite_group_to_link_test— link replacing a group marker;same cleanup invariant, verified through
list/2via link resolution.