rocksdb/db/blob
anand76 269478ee46 Support compressed and local flash secondary cache stacking (#11812)
Summary:
This PR implements support for a three tier cache - primary block cache, compressed secondary cache, and a nvm (local flash) secondary cache. This allows more effective utilization of the nvm cache, and minimizes the number of reads from local flash by caching compressed blocks in the compressed secondary cache.

The basic design is as follows -
1. A new secondary cache implementation, ```TieredSecondaryCache```, is introduced. It keeps the compressed and nvm secondary caches and manages the movement of blocks between them and the primary block cache. To setup a three tier cache, we allocate a ```CacheWithSecondaryAdapter```, with a ```TieredSecondaryCache``` instance as the secondary cache.
2. The table reader passes both the uncompressed and compressed block to ```FullTypedCacheInterface::InsertFull```, allowing the block cache to optionally store the compressed block.
3. When there's a miss, the block object is constructed and inserted in the primary cache, and the compressed block is inserted into the nvm cache by calling ```InsertSaved```. This avoids the overhead of recompressing the block, as well as avoiding putting more memory pressure on the compressed secondary cache.
4. When there's a hit in the nvm cache, we attempt to insert the block in the compressed secondary cache and the primary cache, subject to the admission policy of those caches (i.e admit on second access). Blocks/items evicted from any tier are simply discarded.

We can easily implement additional admission policies if desired.

Todo (In a subsequent PR):
1. Add to db_bench and run benchmarks
2. Add to db_stress

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

Reviewed By: pdillinger

Differential Revision: D49461842

Pulled By: anand1976

fbshipit-source-id: b40ac1330ef7cd8c12efa0a3ca75128e602e3a0b
2023-09-21 20:30:53 -07:00
..
blob_constants.h
blob_contents.cc
blob_contents.h Support compressed and local flash secondary cache stacking (#11812) 2023-09-21 20:30:53 -07:00
blob_counting_iterator.h Refactor AddRangeDels() + consider range tombstone during compaction file cutting (#11113) 2023-02-22 12:28:18 -08:00
blob_counting_iterator_test.cc
blob_fetcher.cc
blob_fetcher.h
blob_file_addition.cc
blob_file_addition.h
blob_file_addition_test.cc
blob_file_builder.cc Add CompressionOptions::checksum for enabling ZSTD checksum (#11666) 2023-08-18 15:01:59 -07:00
blob_file_builder.h
blob_file_builder_test.cc Add CompressionOptions::checksum for enabling ZSTD checksum (#11666) 2023-08-18 15:01:59 -07:00
blob_file_cache.cc Improve memory efficiency of many OptimisticTransactionDBs (#11439) 2023-05-24 11:57:15 -07:00
blob_file_cache.h Improve memory efficiency of many OptimisticTransactionDBs (#11439) 2023-05-24 11:57:15 -07:00
blob_file_cache_test.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
blob_file_completion_callback.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_file_garbage.cc
blob_file_garbage.h
blob_file_garbage_test.cc
blob_file_meta.cc
blob_file_meta.h
blob_file_reader.cc Support compressed and local flash secondary cache stacking (#11812) 2023-09-21 20:30:53 -07:00
blob_file_reader.h Group rocksdb.sst.read.micros stat by different user read IOActivity + misc (#11444) 2023-08-08 17:26:50 -07:00
blob_file_reader_test.cc Add CompressionOptions::checksum for enabling ZSTD checksum (#11666) 2023-08-18 15:01:59 -07:00
blob_garbage_meter.cc
blob_garbage_meter.h
blob_garbage_meter_test.cc
blob_index.h
blob_log_format.cc
blob_log_format.h
blob_log_sequential_reader.cc Group rocksdb.sst.read.micros stat by different user read IOActivity + misc (#11444) 2023-08-08 17:26:50 -07:00
blob_log_sequential_reader.h
blob_log_writer.cc Change internal headers with duplicate names (#11408) 2023-05-17 11:27:09 -07:00
blob_log_writer.h
blob_read_request.h
blob_source.cc Change internal headers with duplicate names (#11408) 2023-05-17 11:27:09 -07:00
blob_source.h Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
blob_source_test.cc Add CompressionOptions::checksum for enabling ZSTD checksum (#11666) 2023-08-18 15:01:59 -07:00
db_blob_basic_test.cc Fix backward iteration issue when user defined timestamp is enabled in BlobDB (#11258) 2023-03-01 13:28:54 -08:00
db_blob_compaction_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
db_blob_corruption_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
db_blob_index_test.cc Track full_history_ts_low per SuperVersion (#11784) 2023-09-13 16:34:18 -07:00
prefetch_buffer_collection.cc
prefetch_buffer_collection.h