-
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
Fix Get() return status when block cache is disabled #8485
Conversation
@ajkr 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.
Thanks for finding/fixing the problem! This feels like something that's reasonably straightforward to cover in a test case, if you have time.
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 do you mind updating HISTORY.md with a "Bug Fixes" item for preventing empty value returned for non-existent key, and a separate item for fixing dropped stat block cache counter updates for failed queries?
@@ -1938,16 +1938,16 @@ void Version::Get(const ReadOptions& read_options, const LookupKey& k, | |||
PERF_COUNTER_BY_LEVEL_ADD(get_from_table_nanos, timer.ElapsedNanos(), | |||
fp.GetHitFileLevel()); | |||
} | |||
if (!status->ok()) { |
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.
Actually is it better to call ReportCounters()
in this old !status->ok()
conditional body? Seems like they are supposed to be updated before return as long as db_statistics_ != nullptr
.
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.
I don't know if I understand you correctly.
You mean the code should look like this?
if (!status->ok()) {
if (db_statistics_ != nullptr) {
get_context.ReportCounters();
}
return;
}
If that, I will change the code soon.
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.
Right.
Sorry, I don't have time to add test cases right now. But I'd like to contribute test cases in later weeks. Is it ok to submit another PR for test cases? |
I'd like to do that, I will update it soon. |
Sure, sounds good. |
@hongrubb has updated the pull request. You must reimport the pull request before landing. |
@hongrubb has updated the pull request. You must reimport the pull request before landing. |
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.
Looks great, thank you very much!
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@hongrubb has updated the pull request. You must reimport the pull request before landing. |
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Do you mind checking this test?
This is from our internal pre-land test run; I don't see the error in any test run here somehow... |
Sure. |
@ajkr Hi, I think I have found the problem. It's very interesting! I found the failed test was added by #8242 25days ago.
@akankshamahajan15 thanks for the test and detailed comment in code, it helped me a lot. And please take a look at this problem, maybe we should change this test. |
Since you fixed the bug of adding statistics when query is failed", this test should be updated to take that into account. Please feel free to update the test. Thanks for fixing the bug. |
@hongrubb has updated the pull request. You must reimport the pull request before landing. |
@hongrubb has updated the pull request. You must reimport the pull request before landing. |
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This PR is for #8453
We need to update
s = biter.status();
whenbiter.status().IsIncomplete()
is true. By doing this, can fix the problem in issue.Besides, we still need to update
db_statistics
inget_context.ReportCounters()
before return back.