diff --git a/db/blob/db_blob_basic_test.cc b/db/blob/db_blob_basic_test.cc index 18ab1ef7d..95ed18253 100644 --- a/db/blob/db_blob_basic_test.cc +++ b/db/blob/db_blob_basic_test.cc @@ -135,6 +135,8 @@ TEST_F(DBBlobBasicTest, IterateBlobsFromCache) { block_based_options.cache_index_and_filter_blocks = true; options.table_factory.reset(NewBlockBasedTableFactory(block_based_options)); + options.statistics = CreateDBStatistics(); + Reopen(options); int num_blobs = 5; @@ -165,6 +167,7 @@ TEST_F(DBBlobBasicTest, IterateBlobsFromCache) { ++i; } ASSERT_EQ(i, num_blobs); + ASSERT_EQ(options.statistics->getAndResetTickerCount(BLOB_DB_CACHE_ADD), 0); } { @@ -180,6 +183,7 @@ TEST_F(DBBlobBasicTest, IterateBlobsFromCache) { iter->SeekToFirst(); ASSERT_NOK(iter->status()); ASSERT_FALSE(iter->Valid()); + ASSERT_EQ(options.statistics->getAndResetTickerCount(BLOB_DB_CACHE_ADD), 0); } { @@ -198,6 +202,8 @@ TEST_F(DBBlobBasicTest, IterateBlobsFromCache) { ++i; } ASSERT_EQ(i, num_blobs); + ASSERT_EQ(options.statistics->getAndResetTickerCount(BLOB_DB_CACHE_ADD), + num_blobs); } { @@ -217,6 +223,7 @@ TEST_F(DBBlobBasicTest, IterateBlobsFromCache) { ++i; } ASSERT_EQ(i, num_blobs); + ASSERT_EQ(options.statistics->getAndResetTickerCount(BLOB_DB_CACHE_ADD), 0); } } diff --git a/db/db_iter.cc b/db/db_iter.cc index 7f2cb8f49..371c20d32 100644 --- a/db/db_iter.cc +++ b/db/db_iter.cc @@ -71,6 +71,7 @@ DBIter::DBIter(Env* _env, const ReadOptions& read_options, read_options.total_order_seek || read_options.auto_prefix_mode), read_tier_(read_options.read_tier), + fill_cache_(read_options.fill_cache), verify_checksums_(read_options.verify_checksums), expose_blob_index_(expose_blob_index), is_blob_(false), @@ -189,6 +190,7 @@ bool DBIter::SetBlobValueIfNeeded(const Slice& user_key, // avoid having to copy options back and forth. ReadOptions read_options; read_options.read_tier = read_tier_; + read_options.fill_cache = fill_cache_; read_options.verify_checksums = verify_checksums_; constexpr FilePrefetchBuffer* prefetch_buffer = nullptr; diff --git a/db/db_iter.h b/db/db_iter.h index 8a4ee3792..1847060dd 100644 --- a/db/db_iter.h +++ b/db/db_iter.h @@ -356,6 +356,7 @@ class DBIter final : public Iterator { // prefix_extractor_ must be non-NULL if the value is false. const bool expect_total_order_inner_iter_; ReadTier read_tier_; + bool fill_cache_; bool verify_checksums_; // Whether the iterator is allowed to expose blob references. Set to true when // the stacked BlobDB implementation is used, false otherwise.