]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Update the block_read_count/block_read_byte counters in MultiGet (#8676)
authoranand76 <anand76@devvm4702.ftw0.facebook.com>
Fri, 20 Aug 2021 18:49:53 +0000 (11:49 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 20 Aug 2021 18:50:42 +0000 (11:50 -0700)
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

table/block_based/block_based_table_reader.cc
table/block_based/block_based_table_reader_test.cc

index c9ee60aeb9060b282ecdb7d42bb39f48d8b5de0a..ee6ccf830c974a0bb48fa96c7abf7fbf3d43ab04 100644 (file)
@@ -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) {
index 07136dbf809a7f18ee51c88d8076643e07f48a61..775f2f505b2799e9fa2a722026ffe51af645a030 100644 (file)
@@ -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);
   }