rocksdb/cache
Peter Dillinger f8c685c4fc Check for and disallow shared key space in block caches (#9172)
Summary:
We have three layers of block cache that often use the same key
but map to different physical data:
* BlockBasedTableOptions::block_cache
* BlockBasedTableOptions::block_cache_compressed
* BlockBasedTableOptions::persistent_cache

If any two of these happen to share an underlying implementation and key
space (insertion into one shows up in another), then memory safety is
broken. The simplest case is block_cache == block_cache_compressed.
(Credit mrambacher for asking about this case in a review.)

With this change, we explicitly check for overlap and preemptively and
safely fail with a Status code.

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

Test Plan: test added. Crashes without new check

Reviewed By: anand1976

Differential Revision: D32465659

Pulled By: pdillinger

fbshipit-source-id: 3876b45b6dce6167e5a7a642725ddc86b96f8e40
2021-11-16 11:16:05 -08:00
..
cache_bench_tool.cc Make SecondaryCache Customizable (#8480) 2021-07-06 09:18:08 -07:00
cache_bench.cc Add (& fix) some simple source code checks (#8821) 2021-09-07 21:19:27 -07:00
cache_entry_roles.cc Account for dictionary-building buffer in global memory limit (#8428) 2021-09-08 12:35:46 -07:00
cache_entry_roles.h Check for and disallow shared key space in block caches (#9172) 2021-11-16 11:16:05 -08:00
cache_entry_stats.h Fix and detect headers with missing dependencies (#8893) 2021-09-10 10:00:26 -07:00
cache_helpers.h Use deleters to label cache entries and collect stats (#8297) 2021-05-19 16:51:13 -07:00
cache_reservation_manager_test.cc RAII support for per cache reservation through handle (#9130) 2021-11-09 12:06:28 -08:00
cache_reservation_manager.cc RAII support for per cache reservation through handle (#9130) 2021-11-09 12:06:28 -08:00
cache_reservation_manager.h RAII support for per cache reservation through handle (#9130) 2021-11-09 12:06:28 -08:00
cache_test.cc Use deleters to label cache entries and collect stats (#8297) 2021-05-19 16:51:13 -07:00
cache.cc Make SecondaryCache Customizable (#8480) 2021-07-06 09:18:08 -07:00
clock_cache.cc Replace most typedef with using= (#8751) 2021-09-07 11:31:59 -07:00
clock_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
lru_cache_test.cc Add lowest_used_cache_tier to ImmutableDBOptions to enable or disable Secondary Cache (#9050) 2021-10-19 15:54:23 -07:00
lru_cache.cc Fix a race in LRUCacheShard::Promote (#8717) 2021-08-30 19:10:55 -07:00
lru_cache.h Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00
sharded_cache.cc Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00
sharded_cache.h Add a stat to count secondary cache hits (#8666) 2021-08-16 21:01:14 -07:00