-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Add Merge Operator support to WriteBatchWithIndex #8135
Conversation
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.
Also update HISTORY.md
@@ -176,6 +176,11 @@ class WriteBatchWithIndex : public WriteBatchBase { | |||
Iterator* NewIteratorWithBase(ColumnFamilyHandle* column_family, | |||
Iterator* base_iterator, | |||
const ReadOptions* opts = nullptr); | |||
Iterator* NewIteratorWithBase(DB* db, Iterator* base_iterator, |
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.
When is the DB parameter needed? (This is public API.)
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.
The DB option is used similarly to the DB option for "GetFromBatchAndBase". Without the DB option, if you see a Merge without a preceding Put/Delete, you cannot get the "initial" value for the key without the DB. If the other signatures are used (without the DB) and a Merge is encountered without a root, then a "MergeInProgress" error is returned.
I can update the comment appropriately when I figure out the wording...
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.
Although I don't know this area well, the rest of the PR LGTM, seems like a clear improvement even if it's not perfect.
Someone questioned whether it's a good idea for WBWI to effectively re-implement all the DB logic (without persistence, etc.). I believe it's potentially useful for finding bugs on both sides if we compare them.
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
Found a solution that did not require the new API signature. Updated the code accordingly. Updated HISTORY
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
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.
OK with me!
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
Summary: Moves some of the structural refactoring from #8135 into this PR. This just cleans up the code by moving implementation out of the .h file and into the .cc file. Should be considered for merge before both #7214 and #8135 Pull Request resolved: #8229 Reviewed By: jay-zhuang Differential Revision: D27999669 Pulled By: mrambacher fbshipit-source-id: 6eccecbf1f11bb9f5a173e86d1e7bc448bc96071
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
1 similar comment
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
1 similar comment
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Attempt to improve code coverage...
@mrambacher has updated the pull request. You must reimport the pull request before landing. |
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
1 similar comment
@mrambacher has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@mrambacher merged this pull request in ff46374. |
Summary: Remove obsolete comment. Support for WriteBatchWithIndex::NewIteratorWithBase when overwrite_key=false is added in #8135, as you can clearly see in the HISTORY.md. Pull Request resolved: #11636 Reviewed By: jowlyzhang Differential Revision: D47722955 Pulled By: ajkr fbshipit-source-id: 4fa44a309d9708e9f4a1530918a9aaf7114c9032
Summary: Remove obsolete comment. Support for WriteBatchWithIndex::NewIteratorWithBase when overwrite_key=false is added in facebook/rocksdb#8135, as you can clearly see in the HISTORY.md. Pull Request resolved: facebook/rocksdb#11636 Reviewed By: jowlyzhang Differential Revision: D47722955 Pulled By: ajkr fbshipit-source-id: 4fa44a309d9708e9f4a1530918a9aaf7114c9032
Summary: Remove obsolete comment. Support for WriteBatchWithIndex::NewIteratorWithBase when overwrite_key=false is added in facebook/rocksdb#8135, as you can clearly see in the HISTORY.md. Pull Request resolved: facebook/rocksdb#11636 Reviewed By: jowlyzhang Differential Revision: D47722955 Pulled By: ajkr fbshipit-source-id: 4fa44a309d9708e9f4a1530918a9aaf7114c9032
The WBWI has two differing modes of operation dependent on the value
of the constructor parameter
overwrite_key
.Currently, regardless of the parameter, neither mode performs as
expected when using Merge. This PR remedies this by correctly invoking
the appropriate Merge Operator before returning results from the WBWI.
Examples of issues that exist which are solved by this PR:
Example 1 with
overwrite_key=false
Currently, from an empty database, the following sequence:
Incorrectly yields
v2
, that is to say that the Merge behaves like a Put.Example 2 with o
verwrite_key=true
Currently, from an empty database, the following sequence:
Incorrectly yields
ERROR: kMergeInProgress
.Example 3 with
overwrite_key=false
Currently, with a database containing
('k1' -> 'v1')
, the following sequence:Incorrectly yields
v1,v2
Example 4 with
overwrite_key=true
Currently, with a database containing
('k1' -> 'v1')
, the following sequence:Incorrectly yields
ERROR: kMergeInProgress
.Example 5 with
overwrite_key=false
Currently, from an empty database, the following sequence:
Incorrectly yields
v1,v2
Example 6 with
overwrite_key=true
Currently, from an empty database,
('k1' -> 'v1')
, the following sequence:Incorrectly yields
ERROR: kMergeInProgress
.