Fix Statistics population in CompactedDBImpl::Get and MultiGet - #15180
Fix Statistics population in CompactedDBImpl::Get and MultiGet#15180harisawan-bit wants to merge 1 commit into
Conversation
Summary: When a database is opened read-only and qualifies for compacted DB mode (such as a single SST file or all files in a single level without merge operators), read operations are handled by `CompactedDBImpl`. In `CompactedDBImpl::Get` and `CompactedDBImpl::MultiGet`, `GetContext` was being constructed with `nullptr` passed for `logger`, `statistics`, and `clock`. Consequently, when callers open a database with `options.statistics` configured, ticker metrics such as `BLOCK_CACHE_HIT`, `BLOCK_CACHE_MISS`, `BLOCK_CACHE_DATA_HIT`, `BLOCK_CACHE_DATA_MISS`, and `BLOCK_CACHE_BYTES_READ` remained at 0 during reads through `CompactedDBImpl`. This patch passes `immutable_db_options_.logger`, `immutable_db_options_.stats`, and `immutable_db_options_.clock` to `GetContext` in both `CompactedDBImpl::Get` and `CompactedDBImpl::MultiGet`, ensuring block cache metrics and logger/clock diagnostics are properly populated. Fixes facebook#15140 Test Plan: Updated `TEST_F(DBBasicTest, CompactedDB)` in `db/db_basic_test.cc` to attach `options.statistics = CreateDBStatistics()` and assert that block cache data hits/misses are counted after `Get` and `MultiGet` calls on a CompactedDB instance.
|
Hi @harisawan-bit! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
When a database is opened read-only and qualifies for compacted DB mode (such as a single SST file or all files in a single level without merge operators), read operations are handled by CompactedDBImpl.
In CompactedDBImpl::Get and CompactedDBImpl::MultiGet, GetContext was being constructed with
ullptr passed for logger, statistics, and clock. Consequently, when callers open a database with options.statistics configured, ticker metrics such as BLOCK_CACHE_HIT, BLOCK_CACHE_MISS, BLOCK_CACHE_DATA_HIT, BLOCK_CACHE_DATA_MISS, and BLOCK_CACHE_BYTES_READ remained at 0 during reads through CompactedDBImpl.
This patch passes immutable_db_options_.logger, immutable_db_options_.stats, and immutable_db_options_.clock to GetContext in both CompactedDBImpl::Get and CompactedDBImpl::MultiGet, ensuring block cache metrics and logger/clock diagnostics are properly populated.
Fixes #15140
Test Plan:
Updated TEST_F(DBBasicTest, CompactedDB) in db/db_basic_test.cc to attach options.statistics = CreateDBStatistics() and assert that block cache data hits/misses are counted after Get and MultiGet calls on a CompactedDB instance.