-
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 misbehaviour of value_found in DBImpl::KeyMayExist. #12935
base: main
Are you sure you want to change the base?
Conversation
8bbe2bc
to
61bba81
Compare
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.
LGTM - just my usual "can we add a test"..
Could you link to the ticket (Closes ...) in the description ?
db/db_impl/db_impl.cc
Outdated
// If block_cache is enabled and the index block of the table didn't | ||
// not present in block_cache, the return value will be Status::Incomplete. | ||
// In this case, key may still exist in the table. | ||
if(value_found != nullptr && s.IsIncomplete()) { | ||
if (value_found != nullptr && s.IsIncomplete()) { | ||
// falsify later if key-may-exist but can't fetch value |
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.
Is it feasible to make a test for this case ?
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.
🤔
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.
@alanpaxton I have test in Java, do yo think I should also write test in C++?
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.
@rhubner I was unclear. I mean to say, can you test the case where keyMayExist but has_value is false ? I presume the functionality you have tested in Java already has C++ tests.
It is probably easier to have a C++ test for this case. My principle with the Java API is that we need to test going from Java to C++ and back. This is usually best achieved by having a Java test which basically mirrors the C++ test.
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.
@alanpaxton Added test.
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.
LGTM thanks
12373e1
to
ee118c8
Compare
ee118c8
to
422fe80
Compare
422fe80
to
e798802
Compare
KeyMayExist
setvalue_found
by default to true. Then if the value is not in cache, TTLDB returnsfalse
because it thinks the value vas found and then mark it as corrupted. False is returned even for values which are in TTLDB.Fix #12921