diff --git a/cache/lru_cache.cc b/cache/lru_cache.cc index 6284c87b5..b72c82403 100644 --- a/cache/lru_cache.cc +++ b/cache/lru_cache.cc @@ -712,12 +712,12 @@ std::shared_ptr LRUCacheOptions::MakeSharedCache() const { return cache; } -std::shared_ptr LRUCacheOptions::MakeSharedGeneralCache() const { +std::shared_ptr LRUCacheOptions::MakeSharedRowCache() const { if (secondary_cache) { - // Not allowed for a GeneralCache + // Not allowed for a RowCache return nullptr; } - // Works while GeneralCache is an alias for Cache + // Works while RowCache is an alias for Cache return MakeSharedCache(); } } // namespace ROCKSDB_NAMESPACE diff --git a/db/db_test.cc b/db/db_test.cc index 780b1c6ab..609f96ea5 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -6902,16 +6902,16 @@ TEST_F(DBTest, RowCache) { options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); LRUCacheOptions cache_options; cache_options.capacity = 8192; - options.row_cache = cache_options.MakeSharedGeneralCache(); + options.row_cache = cache_options.MakeSharedRowCache(); // BEGIN check that Cache classes as aliases of each other. - // Currently, GeneralCache and BlockCache are aliases for Cache. + // Currently, RowCache and BlockCache are aliases for Cache. // This is expected to change (carefully, intentionally) - std::shared_ptr general_cache = options.row_cache; - std::shared_ptr cache = general_cache; - std::shared_ptr block_cache = general_cache; - general_cache = cache; + std::shared_ptr row_cache = options.row_cache; + std::shared_ptr cache = row_cache; + std::shared_ptr block_cache = row_cache; + row_cache = cache; block_cache = cache; - general_cache = block_cache; + row_cache = block_cache; cache = block_cache; // END check that Cache classes as aliases of each other. DestroyAndReopen(options); diff --git a/include/rocksdb/cache.h b/include/rocksdb/cache.h index 2708e752d..550b45859 100644 --- a/include/rocksdb/cache.h +++ b/include/rocksdb/cache.h @@ -32,18 +32,18 @@ class SecondaryCache; // example, HyperClockCache is not usable as a general cache because it expects // only fixed-size block cache keys, but this limitation is not yet reflected // in the API function signatures. -// * Phase 1 (done) - Make both BlockCache and GeneralCache aliases for Cache, -// and make a factory function for general caches. Encourage users of row_cache -// (not common) to switch to the factory function for general caches. -// * Phase 2 - Split off GenericCache as its own class, removing secondary +// * Phase 1 (done) - Make both BlockCache and RowCache aliases for Cache, +// and make a factory function for row caches. Encourage users of row_cache +// (not common) to switch to the factory function for row caches. +// * Phase 2 - Split off RowCache as its own class, removing secondary // cache support features and more from the API to simplify it. Between Phase 1 // and Phase 2 users of row_cache will need to update their code. Any time -// after Phase 2, the block cache API can become more specialized in ways -// incompatible with general caches. +// after Phase 2, the block cache and row cache APIs can become more specialized +// in ways incompatible with general caches. // * Phase 3 - Move existing RocksDB uses of Cache to BlockCache, and deprecate // (but not yet remove) Cache as an alias for BlockCache. using BlockCache = Cache; -using GeneralCache = Cache; +using RowCache = Cache; // Classifications of block cache entries. // @@ -155,7 +155,7 @@ struct ShardedCacheOptions { CacheMetadataChargePolicy metadata_charge_policy = kDefaultCacheMetadataChargePolicy; - // A SecondaryCache instance to use the non-volatile tier. For a GeneralCache + // A SecondaryCache instance to use the non-volatile tier. For a RowCache // this option must be kept as default empty. std::shared_ptr secondary_cache; @@ -260,9 +260,9 @@ struct LRUCacheOptions : public ShardedCacheOptions { // Construct an instance of LRUCache using these options std::shared_ptr MakeSharedCache() const; - // Construct an instance of LRUCache for use as a general cache (e.g. for - // row_cache). Some options are not relevant to general caches. - std::shared_ptr MakeSharedGeneralCache() const; + // Construct an instance of LRUCache for use as a row cache, typically for + // `DBOptions::row_cache`. Some options are not relevant to row caches. + std::shared_ptr MakeSharedRowCache() const; }; // DEPRECATED wrapper function diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index d37af823c..16f6d94ae 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -1157,7 +1157,7 @@ struct DBOptions { // A global cache for table-level rows. // Default: nullptr (disabled) - std::shared_ptr row_cache = nullptr; + std::shared_ptr row_cache = nullptr; // A filter object supplied to be invoked while processing write-ahead-logs // (WALs) during recovery. The filter provides a way to inspect log diff --git a/unreleased_history/public_api_changes/rename_migration_caches.md b/unreleased_history/public_api_changes/rename_migration_caches.md new file mode 100644 index 000000000..3db59947d --- /dev/null +++ b/unreleased_history/public_api_changes/rename_migration_caches.md @@ -0,0 +1 @@ +Removed recently added APIs `GeneralCache` and `MakeSharedGeneralCache()` as our plan changed to stop exposing a general-purpose cache interface. The old forms of these APIs, `Cache` and `NewLRUCache()`, are still available, although general-purpose caching support will be dropped eventually.