[DocDB] Fix statistic RocksDB_read_block_get_micros to include all reads
#11,744 opened on Mar 14, 2022
Repository metrics
- Stars
- (8,229 stars)
- PR merge metrics
- (Avg merge 17d 21h) (92 merged PRs in 30d)
Description
Jira Link: DB-948
Description
(thanks to an investigation with @ttyusupov)
Currently in YB version 2.13.0.0 build 42, the statistic rocksdb_read_block_get_micros is only measured and incremented for any read that has the intention to populate the block based cache. This means that for a read with the block based cache disabled, this statistic is not incremented.
This is fixed in the rocksdb main code with pull request 3442. I think it makes sense to correct this in our code too.
That brings a visibility problem: currently the difference between rocksdb_sst_read_micros (number of read calls submitted to the OS) and rocksdb_read_block_get_micros gives an indication of the number of blocks read for compaction. With the above fix, compaction will add to the rocksdb_read_block_get_micros statistic, and thus the number of DocDB client reads cannot be derived.
I would suggest create a specific read block statistic for compaction, such as rocksdb_read_block_compaction_get_micros, and a statistic rocksdb_read_block_request_get_micros for DocDB client requests, so the two can be differentiated.