Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Merge.Level to MergeType and extend with MergeUnion enum value #524

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dcoutts
Copy link
Collaborator

@dcoutts dcoutts commented Jan 13, 2025

Prep for merging trees.

In Test.Database.LSMTree.Internal.Snapshot.Codec, import the general
Database.LSMTree.Extras.Generators and use several of the arbitrary
instances from there. Remove ones that were duplicates, and remove
overlapping instances.
This follows the naming scheme from the prototype.

This just adds the new enum (and renames) but does not introduce any new
merging behaviour yet, and the new MergeUnion value is not used (except
in snapshot (de)serialisation).
@dcoutts dcoutts force-pushed the dcoutts/merging-tree branch from 3e3cc52 to 64cd6d7 Compare January 13, 2025 12:22
Copy link
Collaborator

@mheinzel mheinzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't implement the new union merge type yet, right? That's alright, we can do it afterwards, but then there should be a comment/TODO somewhere.

Comment on lines +199 to 201
mergeWriteBuffers mergeType =
(if mergeType == MergeLastLevel then Map.filter (not . isDelete) else id)
. Map.unionsWith (Entry.combine mappendValues)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also need to handle MergeUnion differently, maybe add a TODO so we don't forget.

mergeWriteBuffers level =
(if level == Merge.LastLevel then Map.filter (not . isDelete) else id)
mergeWriteBuffers mergeType =
(if mergeType == MergeLastLevel then Map.filter (not . isDelete) else id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is where the test failure comes from. Union merges also drop Deletes (https://github.com/IntersectMBO/lsm-tree/pull/524/files#diff-fa33669ac986142f1cd163910716d90a92851522d036426f451e3cd069b0e5e2R393).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants