Skip to content

Fix misbehaviour of value_found in DBImpl::KeyMayExist.#12935

Open
rhubner wants to merge 4 commits into
facebook:mainfrom
evolvedbinary:eb/key-exists-bug
Open

Fix misbehaviour of value_found in DBImpl::KeyMayExist.#12935
rhubner wants to merge 4 commits into
facebook:mainfrom
evolvedbinary:eb/key-exists-bug

Conversation

@rhubner

@rhubner rhubner commented Aug 14, 2024

Copy link
Copy Markdown
Contributor

KeyMayExist set value_found by default to true. Then if the value is not in cache, TTLDB returns false 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

@rhubner rhubner force-pushed the eb/key-exists-bug branch 2 times, most recently from 8bbe2bc to 61bba81 Compare August 14, 2024 10:58

@alanpaxton alanpaxton left a comment

Copy link
Copy Markdown
Contributor

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 ?

Comment thread db/db_impl/db_impl.cc Outdated
// 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

Copy link
Copy Markdown
Contributor

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 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤔

Copy link
Copy Markdown
Contributor Author

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++?

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alanpaxton Added test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM thanks

@rhubner rhubner force-pushed the eb/key-exists-bug branch 2 times, most recently from 12373e1 to ee118c8 Compare August 29, 2024 08:17
@rhubner rhubner marked this pull request as ready for review August 30, 2024 13:03
@rhubner rhubner force-pushed the eb/key-exists-bug branch 2 times, most recently from 422fe80 to e798802 Compare September 30, 2024 17:19
@alanpaxton alanpaxton force-pushed the eb/key-exists-bug branch from e798802 to 4e0d49b Compare May 19, 2025 08:24
@adamretter adamretter added bug Confirmed RocksDB bugs java-api labels Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed RocksDB bugs CLA Signed java-api

4 participants