rocksdb/cache
anand76 54aebb2cc5 Fix cache metrics update when secondary cache is used (#10440)
Summary:
If a secondary cache is configured, its possible that a cache lookup will get a hit in the secondary cache. In that case, the ```LRUCacheShard::Lookup``` doesn't immediately update the ```total_charge``` for the item handle if the ```wait``` parameter is false (i.e caller will call later to check the completeness). However, ```BlockBasedTable::GetEntryFromCache``` assumes the handle is complete and calls ```UpdateCacheHitMetrics```, which checks the usage of the cache item and fails the assert in https://github.com/facebook/rocksdb/blob/main/cache/lru_cache.h#L237 (```assert(total_charge >= meta_charge)```).

To fix this, we call ```UpdateCacheHitMetrics``` later in ```MultiGet```, after waiting for all cache lookup completions.

Test plan -
Run crash test with changes from https://github.com/facebook/rocksdb/issues/10160

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10440

Reviewed By: gitbw95

Differential Revision: D38283968

Pulled By: anand1976

fbshipit-source-id: 31c54ef43517726c6e5fdda81899b364241dd7e1
2022-07-29 14:24:44 -07:00
..
cache.cc Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
cache_bench.cc Add (& fix) some simple source code checks (#8821) 2021-09-07 21:19:27 -07:00
cache_bench_tool.cc Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
cache_entry_roles.cc Charge blob cache usage against the global memory limit (#10321) 2022-07-18 23:26:57 -07:00
cache_entry_roles.h Expose CacheEntryRole and map keys for block cache stat collections (#9838) 2022-04-14 09:38:55 -07:00
cache_entry_stats.h New stable, fixed-length cache keys (#9126) 2021-12-16 17:15:13 -08:00
cache_helpers.h Eliminate the copying of blobs when serving reads from the cache (#10297) 2022-07-06 18:57:29 -07:00
cache_key.cc Enhance new cache key testing & comments (#9329) 2022-02-04 14:15:58 -08:00
cache_key.h Fix key size in cache_bench (#10234) 2022-06-23 11:26:50 -07:00
cache_reservation_manager.cc Charge blob cache usage against the global memory limit (#10321) 2022-07-18 23:26:57 -07:00
cache_reservation_manager.h Account memory of FileMetaData in global memory limit (#9924) 2022-06-14 13:06:40 -07:00
cache_reservation_manager_test.cc Have Cache use Status::MemoryLimit (#10262) 2022-07-06 14:41:46 -07:00
cache_test.cc Towards a production-quality ClockCache (#10418) 2022-07-26 17:42:03 -07:00
charged_cache.cc Charge blob cache usage against the global memory limit (#10321) 2022-07-18 23:26:57 -07:00
charged_cache.h Charge blob cache usage against the global memory limit (#10321) 2022-07-18 23:26:57 -07:00
clock_cache.cc Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
clock_cache.h Fix assertion failure and memory leak in ClockCache. (#10430) 2022-07-27 18:55:55 -07:00
compressed_secondary_cache.cc Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
compressed_secondary_cache.h Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
compressed_secondary_cache_test.cc Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
fast_lru_cache.cc Towards a production-quality ClockCache (#10418) 2022-07-26 17:42:03 -07:00
fast_lru_cache.h Clock cache (#10273) 2022-06-29 21:50:39 -07:00
lru_cache.cc Fix cache metrics update when secondary cache is used (#10440) 2022-07-29 14:24:44 -07:00
lru_cache.h Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
lru_cache_test.cc Revert "Add a blob-specific cache priority (#10309)" (#10434) 2022-07-29 07:18:15 -07:00
sharded_cache.cc Update Cache::Release param from force_erase to erase_if_last_ref (#9728) 2022-03-22 10:22:18 -07:00
sharded_cache.h Charge blob cache usage against the global memory limit (#10321) 2022-07-18 23:26:57 -07:00