From 30a5ed9c53c4684d7853ba836aee3a51a00e407d Mon Sep 17 00:00:00 2001 From: Akanksha Mahajan <43301668+akankshamahajan15@users.noreply.github.com> Date: Wed, 23 Dec 2020 15:15:14 -0800 Subject: [PATCH] Update "num_data_read" stat in RetrieveMultipleBlocks (#7770) Summary: RetrieveMultipleBlocks which is used by MultiGet to read data blocks is not updating num_data_read stat in GetContextStats. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7770 Test Plan: make check -j64 Reviewed By: anand1976 Differential Revision: D25538982 Pulled By: akankshamahajan15 fbshipit-source-id: e3daedb035b1be8ab6af6f115cb3793ccc7b1ec6 --- db/db_basic_test.cc | 2 +- table/block_based/block_based_table_reader.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/db/db_basic_test.cc b/db/db_basic_test.cc index 691871663..5912d5830 100644 --- a/db/db_basic_test.cc +++ b/db/db_basic_test.cc @@ -1961,7 +1961,7 @@ TEST_F(DBBasicTest, MultiGetStats) { ASSERT_GT(hist_sst.max, 0); // Minimun number of blocks read in a level. - ASSERT_EQ(hist_data_blocks.min, 0); + ASSERT_EQ(hist_data_blocks.min, 3); ASSERT_GT(hist_index_and_filter_blocks.min, 0); // Minimun number of sst files read in a level. ASSERT_GT(hist_sst.max, 0); diff --git a/table/block_based/block_based_table_reader.cc b/table/block_based/block_based_table_reader.cc index 628f1026d..0aa380965 100644 --- a/table/block_based/block_based_table_reader.cc +++ b/table/block_based/block_based_table_reader.cc @@ -1768,6 +1768,9 @@ void BlockBasedTable::RetrieveMultipleBlocks( size_t& req_idx = req_idx_for_block[valid_batch_idx]; size_t& req_offset = req_offset_for_block[valid_batch_idx]; valid_batch_idx++; + if (mget_iter->get_context) { + ++(mget_iter->get_context->get_context_stats_.num_data_read); + } FSReadRequest& req = read_reqs[req_idx]; Status s = req.status; if (s.ok()) {