diff --git a/table/block_based/block_based_table_reader.cc b/table/block_based/block_based_table_reader.cc index c9ee60aeb..ee6ccf830 100644 --- a/table/block_based/block_based_table_reader.cc +++ b/table/block_based/block_based_table_reader.cc @@ -1713,6 +1713,9 @@ void BlockBasedTable::RetrieveMultipleBlocks( req_offset_for_block.emplace_back(0); } req_idx_for_block.emplace_back(read_reqs.size()); + + PERF_COUNTER_ADD(block_read_count, 1); + PERF_COUNTER_ADD(block_read_byte, block_size(handle)); } // Handle the last block and process the pending last request if (prev_len != 0) { diff --git a/table/block_based/block_based_table_reader_test.cc b/table/block_based/block_based_table_reader_test.cc index 07136dbf8..775f2f505 100644 --- a/table/block_based/block_based_table_reader_test.cc +++ b/table/block_based/block_based_table_reader_test.cc @@ -228,8 +228,16 @@ TEST_P(BlockBasedTableReaderTest, MultiGet) { // Execute MultiGet. MultiGetContext::Range range = ctx.GetMultiGetRange(); + PerfContext* perf_ctx = get_perf_context(); + perf_ctx->Reset(); table->MultiGet(ReadOptions(), &range, nullptr); + ASSERT_GE(perf_ctx->block_read_count - perf_ctx->index_block_read_count - + perf_ctx->filter_block_read_count - + perf_ctx->compression_dict_block_read_count, + 1); + ASSERT_GE(perf_ctx->block_read_byte, 1); + for (const Status& status : statuses) { ASSERT_OK(status); }