facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
27.85k stars 6.2k forks source link

WIP: EnforceReadOpts #12765

Open pdillinger opened 3 weeks ago

pdillinger commented 3 weeks ago

Summary: Follow-up from #12757. New infrastructure to DEBUG builds to catch certain ReadOptions being ignored in a context where they should be in effect. This currently only applies to checking that no IO happens when read_tier == kBlockCacheTier. The check is in effect for unit tests and for stress/crash tests.

Specifically, an EnforceReadOpts object on the stack establishes a thread-local context under which we assert no IOs are performed if the provided ReadOptions said it should be forbidden.

Test Plan: Reports failure before production code fix in #12757

pdillinger commented 3 weeks ago

@hx235 We can continue the discussion about EnforceReadOpts here.

With regard to calling UsedIO from lower-level IO functions, I worry a bit about the fan-out to various implementations and functions, so I thought that block fetcher and prefetcher were pretty good places to catch between the caller fan-in and the implementation fan-out. Let me know if you have concrete suggestion.