Update the block_read_count/block_read_byte counters in MultiGet (#8676)

Summary:
MultiGet in block based table reader doesn't use BlockFetcher. As a result, the block_read_count and block_read_byte PerfContext counters were not being updated. This fixes that by updating them in MultiRead.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8676

Reviewed By: zhichao-cao

Differential Revision: D30428680

Pulled By: anand1976

fbshipit-source-id: 21846efe92588fc17123665dd06733693a40126d
main
anand76 3 years ago committed by Facebook GitHub Bot
parent 5efec84c60
commit 22f2936b35
  1. 3
      table/block_based/block_based_table_reader.cc
  2. 8
      table/block_based/block_based_table_reader_test.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) {

@ -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);
}

Loading…
Cancel
Save