rocksdb
rocksdb copied to clipboard
ReadOptions::verify_checksums flag is not propagated to reads of meta blocks (index, filter, compression dictionary etc.)
Expected behavior
If I specify ReadOptions::verify_checksums=false
while reading a key from RocksDB no CRC32 checksums are computed.
Actual behavior
I see that CRC32 checksums are not computed for data block but are computed for meta blocks. Here is a performance flame chart for a synthetic test of reading 100K random keys from a rocksdb having 250M keys:
Steps to reproduce the behavior
Create a rocksdb instance insert random 250M random key/value pairs and then read 100K random keys.
Code fix
Here is basically a PR showing the particular code pointers where varify_checksums
flag is not propagated which is helping to get rid of all unnecessary CRC32 checksum computations: https://github.com/facebook/rocksdb/pull/10427. It's a drafty PR helping to see where the issue come from. I would really appreciate if code owners show me the direction how to propagate verify_checksums
flag everywhere aligned with the current design.
@ajkr any suggestions here on how should I proceed? I believe I can't just turn CRC32 computation on meta blocks. Should I try to propagate the flag from upstream? Is there any know obstacles to do that?
I think the ReadOptions, including verify_checksums, should be propagated to meta-block reads. We know cases they currently aren't, such as this one discovered recently - https://github.com/facebook/rocksdb/pull/10438/files#r932893036. But I have yet to discover any valid reason for dropping any ReadOptions. So we're glad to consider PRs like yours that propagate more ReadOptions to meta-blocks.