-
Notifications
You must be signed in to change notification settings - Fork 233
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
Make dvv_enabled
a bucket property
#891
Conversation
First, remove unnecessary dict -> list -> dict conversion. This conversion was previously added to address a bug arising from equivalent dicts having different structure (and thus not comparing equal as terms). Rather than performing the conversion, this commit uses a custom comparison function to achieve the same effect. The new comparison approach exits early in the common case. Even in the uncommon case, the comparison function only does a dict -> list conversion, avoiding the final list -> dict from before. Second, change fold_contents/3 to not use an ordset for tracking kept siblings (which has O(N^2) complexity), but instead construct a simple list (with possible duplicates) that is then sorted/filtered at the end. In micro-benchmarking, this commit improved non-DVV merging by 10x, and DVV merging by 2x.
…-opt-merge Conflicts: src/riak_object.erl
Set it's default to `false` on legacy/default buckets Set it's default to `true` on typed buckets Update all the tests and associated places this change touches
Sorry @cmeiklejohn do not have the time/patience to put the optimisations and bucket prop stuff as separate things. Feel free to do it yourself, though. |
Do any of the tests specifically test the false case? The case where the bucket is mecked to return [] and [dvv_enabled] both end up executing the true case, since the default of the get_value is true. |
Other than that, I'm 👍 on this changeset. |
I didn't write new tests, no. I can write some on Monday, or you can add some if you like. |
Cool, just wanted to make sure you didn't think something was tested that wasn't. I'd say merge. |
Oh, it needs basho/riak_core#568 |
Make `dvv_enabled` a bucket property
@@ -294,6 +295,41 @@ merge_contents(NewObject, OldObject, true) -> | |||
riak_kv_crdt:log_merge_errors(Bucket, Key, CRDT, Error), | |||
merge_acc_to_contents(MergeAcc). | |||
|
|||
%% Optimisation. To save converting every meta dict to a list sorting, | |||
%% comapring, and coverting back again, we use this optimisation, that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the game, but well spotted. New branch and PR? Or live with it like "referer"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set it's default to false on legacy/default buckets
Set it's default to true on typed buckets
Update all the tests and associated places this change touches