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

Change ParseInternalKey() to return Status instead of bool #7457

Closed
wants to merge 22 commits into from

Conversation

ramvadiv
Copy link
Contributor

@ramvadiv ramvadiv commented Sep 29, 2020

Fixes #7430

Change ParseInternalKey() to return Status instead of bool.

db_bench (seekrandom) based before/after results with value size of 100 bytes and 16 bytes can be found at (tests ran on an udb server):
https://www.dropbox.com/s/47bwamdy5ozngph/PIK_ret_Status_results.xlsx?dl=0

db_bench_results

@ramvadiv ramvadiv changed the title PR 7430 - Change ParseInternalKey() to return Status instead of bool Change ParseInternalKey() to return Status instead of bool (on behalf of PR#7430) Sep 29, 2020
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@ramvadiv ramvadiv marked this pull request as ready for review September 30, 2020 04:03
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ramvadiv 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.

LGTM! There could probably be a follow-up task to combine this with #7420 by pushing down the option's value into ParseInternalKey() (defaulting to false when unknown) and then including the corrupt key in the Status::Corruption there.

The github convention for linking an issue is to put a line "Fixes #7430." in the description (rather than title), then it'll auto-close the issue when this PR merges.

db/merge_helper.cc Outdated Show resolved Hide resolved
db/range_del_aggregator.cc Outdated Show resolved Hide resolved
db/range_del_aggregator.cc Outdated Show resolved Hide resolved
@@ -283,7 +283,7 @@ class RangeDelAggregator {

bool ShouldDelete(const Slice& key, RangeDelPositioningMode mode) {
ParsedInternalKey parsed;
if (!ParseInternalKey(key, &parsed)) {
if (ParseInternalKey(key, &parsed) != Status::OK()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same, I think the return false should even be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for your review/comments Andrew. I have handled all of your other comments. I am not very clear about this point - Shouldn't we still return false in this case?

Copy link
Contributor

@ajkr ajkr Sep 30, 2020

Choose a reason for hiding this comment

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

I don't know. Returning false originally felt safe here because it conservatively preserves data that we cannot conclusively determine whether it's deleted due to a corruption. OTOH, it doesn't seem right to have a code path that makes a guess about whether data is deleted or not, even if it is the seemingly safer guess. The final solution should involve propagating the Status, so I guess it doesn't matter much what we do in the meantime since I don't think there are any good options (leave the return false; guess here, or let the code continue and probably crash).

@facebook-github-bot
Copy link
Contributor

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

@ramvadiv ramvadiv changed the title Change ParseInternalKey() to return Status instead of bool (on behalf of PR#7430) Change ParseInternalKey() to return Status instead of bool Sep 30, 2020
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

…uted to circleci: build-linux-shared_lib-alt_namespace-status_checked test failure
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

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

@facebook-github-bot
Copy link
Contributor

@ramvadiv merged this pull request in e04a509.

@ramvadiv ramvadiv deleted the PR_7430 branch October 5, 2020 00:17
codingrhythm pushed a commit to SafetyCulture/rocksdb that referenced this pull request Mar 5, 2021
…7457)

Summary:
Fixes facebook#7430

Change ParseInternalKey() to return Status instead of bool.

db_bench (seekrandom) based before/after results with value size of 100 bytes and 16 bytes can be found at (tests ran on an udb server):
https://www.dropbox.com/s/47bwamdy5ozngph/PIK_ret_Status_results.xlsx?dl=0

![db_bench_results](https://user-images.githubusercontent.com/62277872/94642825-2a21a800-029a-11eb-88f2-124136c83fd3.png)

Pull Request resolved: facebook#7457

Reviewed By: ajkr

Differential Revision: D24002433

Pulled By: ramvadiv

fbshipit-source-id: ac253ecf577a29044c47c3fe254a01e71404c44c
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.

investigate making ParseInternalKey() return a Status
4 participants