-
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
Update MultiGet to respect the strict_capacity_limit block cache option #13104
Update MultiGet to respect the strict_capacity_limit block cache option #13104
Conversation
7cdd8cb
to
0370fdb
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.
Thanks for the thorough test! LGTM.
bf387a2
to
3e0ff07
Compare
3e0ff07
to
a2f0a52
Compare
@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
9e83077
to
97e727d
Compare
@archang19 has updated the pull request. You must reimport the pull request before landing. |
@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
// block_entry value could be null if no block cache is present, i.e | ||
// BlockBasedTableOptions::no_block_cache is true and no compressed | ||
// block cache is configured. In that case, fall | ||
// through and set up the block explicitly | ||
if (block_entry->GetValue() != nullptr) { | ||
s.PermitUncheckedError(); |
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.
@anand1976 I saw that you added this code in #9968. I updated this PR to remove this line because now we have the !s.ok()
block which also calls MarkChecked()
inside Status
@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
97e727d
to
a6b0cb6
Compare
@archang19 has updated the pull request. You must reimport the pull request before landing. |
@archang19 has imported this pull request. If you are a Meta 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.
LGTM
@archang19 merged this pull request in 7c98a2d. |
Summary
There is a
strict_capacity_limit
option which imposes a hard memory limit on the block cache. When the block cache is enabled, every read request is serviced from the block cache. If the required block is missing, it is first inserted into the cache. Ifstrict_capacity_limit
istrue
and the limit has been reached, theGet
andMultiGet
requests should fail. However, currently this is not happening forMultiGet
.I updated
MultiGet
to explicitly check the returned status ofMaybeReadBlockAndLoadToCache
, so the status does not get overwritten later.Thank you @anand1976 for the problem explanation.
Test Plan
Added unit test for both
Get
andMultiGet
with astrict_capacity_limit
set.Before the change, half of my unit test cases failed https://github.com/facebook/rocksdb/actions/runs/11604597524/job/32313608085?pr=13104. After I added the check for the status returned by
MaybeReadBlockAndLoadToCache
, they all pass.I also ran these tests manually (I had to run
make clean
before):