From 5a97e6b1d23fec6ce70bb919e67878cbc2444372 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Tue, 6 Sep 2022 13:01:05 -0700 Subject: [PATCH] Deflake blob caching tests (#10636) Summary: Example failure: ``` db/blob/db_blob_basic_test.cc:226: Failure Expected equality of these values: i Which is: 1 num_blobs Which is: 5 ``` I can't repro locally, but it looks like the 2KB cache is too small to guarantee no eviction happens between loading all the data into cache and reading from `kBlockCacheTier`. This 2KB setting appears to have come from a test where the cached entries are pinned, where it makes sense to have a small setting. However, such a small setting makes less sense when the blocks are evictable but must remain cached per the test's expectation. This PR increases the capacity setting to 2MB for those cases. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10636 Reviewed By: cbi42 Differential Revision: D39250976 Pulled By: ajkr fbshipit-source-id: 769309f9a19cfac20b67b927805c8df5c1d2d1f5 --- db/blob/db_blob_basic_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/blob/db_blob_basic_test.cc b/db/blob/db_blob_basic_test.cc index df009bffa..bf5f646bb 100644 --- a/db/blob/db_blob_basic_test.cc +++ b/db/blob/db_blob_basic_test.cc @@ -54,7 +54,7 @@ TEST_F(DBBlobBasicTest, GetBlobFromCache) { Options options = GetDefaultOptions(); LRUCacheOptions co; - co.capacity = 2048; + co.capacity = 2 << 20; // 2MB co.num_shard_bits = 2; co.metadata_charge_policy = kDontChargeCacheMetadata; auto backing_cache = NewLRUCache(co); @@ -122,7 +122,7 @@ TEST_F(DBBlobBasicTest, IterateBlobsFromCache) { Options options = GetDefaultOptions(); LRUCacheOptions co; - co.capacity = 2048; + co.capacity = 2 << 20; // 2MB co.num_shard_bits = 2; co.metadata_charge_policy = kDontChargeCacheMetadata; auto backing_cache = NewLRUCache(co); @@ -453,7 +453,7 @@ TEST_F(DBBlobBasicTest, MultiGetBlobsFromCache) { Options options = GetDefaultOptions(); LRUCacheOptions co; - co.capacity = 2048; + co.capacity = 2 << 20; // 2MB co.num_shard_bits = 2; co.metadata_charge_policy = kDontChargeCacheMetadata; auto backing_cache = NewLRUCache(co);