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

Fix wrong smallest key of delete range tombstones #2799

Closed
wants to merge 4 commits into from
Closed

Fix wrong smallest key of delete range tombstones #2799

wants to merge 4 commits into from

Conversation

huachaohuang
Copy link
Contributor

Since tombstones are not stored in order, we may get a wrong smallest key if we only consider the first added tombstone.
Check #2752 for more details.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

@huachaohuang updated the pull request - view changes

@facebook-github-bot
Copy link
Contributor

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

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

Thanks so much for finding this difficult bug! :)

@@ -412,7 +412,6 @@ void RangeDelAggregator::AddToBuilder(

// Note the order in which tombstones are stored is insignificant since we
// insert them into a std::map on the read path.
bool first_added = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

could you have just moved this one line lower? Within each stripe the tombstones should be sorted. So we only need to consider the first tombstone in each stripe.

@@ -149,6 +149,38 @@ TEST_F(RangeDelAggregatorTest, AlternateMultipleAboveBelow) {
{"h", 0}});
}

TEST_F(RangeDelAggregatorTest, UnorderedTombstones) {
Copy link
Contributor

@ajkr ajkr Aug 29, 2017

Choose a reason for hiding this comment

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

Also this belongs in db/db_range_del_test.cc

@facebook-github-bot
Copy link
Contributor

@huachaohuang updated the pull request - view changes - changes since last import

@ajkr
Copy link
Contributor

ajkr commented Aug 30, 2017

Excellent, thanks everyone at PingCAP who helped find this bug :).

@facebook-github-bot
Copy link
Contributor

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@huachaohuang updated the pull request - view changes - changes since last import

@facebook-github-bot
Copy link
Contributor

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@zhangjinpeng87
Copy link
Contributor

@ajkr Can you please release a version after this pr has been merged, combine with this bug fix?

facebook-github-bot pushed a commit that referenced this pull request Aug 30, 2017
Summary:
fixed in #2799
Closes #2805

Differential Revision: D5734324

Pulled By: ajkr

fbshipit-source-id: a285d4e84bf1018dc2257fd6c3e7c075a7243263
ajkr pushed a commit that referenced this pull request Aug 30, 2017
Summary:
Since tombstones are not stored in order, we may get a wrong smallest key if we only consider the first added tombstone.
Check #2752 for more details.
Closes #2799

Differential Revision: D5728217

Pulled By: ajkr

fbshipit-source-id: 4a53edb0ca80d2a9fcf10749e52d47d57d6417d3
ajkr added a commit that referenced this pull request Aug 30, 2017
Summary:
fixed in #2799
Closes #2805

Differential Revision: D5734324

Pulled By: ajkr

fbshipit-source-id: a285d4e84bf1018dc2257fd6c3e7c075a7243263
@ajkr
Copy link
Contributor

ajkr commented Aug 30, 2017

@zhangjinpeng1987 - sure, the 5.7.3 release is available now containing both fixes.

petermattis added a commit to cockroachdb/rocksdb that referenced this pull request Sep 8, 2017
Summary:
Since tombstones are not stored in order, we may get a wrong smallest
key if we only consider the first added tombstone.  Check
facebook#2752 for more details.
Closes facebook#2799

Differential Revision: D5728217

Pulled By: ajkr

fbshipit-source-id: 4a53edb0ca80d2a9fcf10749e52d47d57d6417d3
petermattis added a commit to cockroachdb/rocksdb that referenced this pull request Sep 11, 2017
Summary:
Since tombstones are not stored in order, we may get a wrong smallest
key if we only consider the first added tombstone.
Check facebook#2752 for more details.
Closes facebook#2799

Differential Revision: D5728217

Pulled By: ajkr
@huachaohuang huachaohuang deleted the huachao/fix-2752 branch September 29, 2017 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants