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 MultiGet dropping memtable kv checksum corruption #12842

Closed
wants to merge 4 commits into from

Conversation

cbi42
Copy link
Member

@cbi42 cbi42 commented Jul 6, 2024

Corruption status returned by GetFromTable() could be overwritten here:

*(iter->s) = Status::OK();

This PR fixes this issue by setting *(s->found_final_value) = true; in SaveValue. Also makes the handling of the return value of GetFromTable() more robust and added asserts in a couple places.

Test plan: Updated an existing unit test to cover MultiGet. It fails the assertion here before this PR:

assert(iter->s->ok() || iter->s->IsMergeInProgress());

@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 requested a review from ajkr July 8, 2024 22:49
@cbi42 cbi42 requested a review from anand1976 July 29, 2024 18:30
Copy link
Contributor

@anand1976 anand1976 left a comment

Choose a reason for hiding this comment

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

History needs to be updated

db/memtable.cc Outdated
@@ -1310,7 +1314,7 @@ bool MemTable::Get(const LookupKey& key, std::string* value,

// No change to value, since we have not yet found a Put/Delete
// Propagate corruption error
if (!found_final_value && merge_in_progress && !s->IsCorruption()) {
if (!found_final_value && merge_in_progress && s->ok()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we assert(s,ok())? If non-ok status, then found_final_value should always be true right?

Copy link
Member Author

Choose a reason for hiding this comment

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

It can also be merge in process, added assert on this.

@facebook-github-bot
Copy link
Contributor

@cbi42 has updated the pull request. You must reimport the pull request before landing.

@cbi42
Copy link
Member Author

cbi42 commented Aug 8, 2024

History needs to be updated

Added, thanks for the review.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@cbi42 merged this pull request in b32d899.

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

3 participants