Fix c_test:filter for various CACHE_LINE_SIZEs (#6153)

Summary:
This test was recently updated but failed to account for Bloom
schema variance by CACHE_LINE_SIZE. (Since CACHE_LINE_SIZE is not
defined in our C code, the test now simply allows a valid result for any
CACHE_LINE_SIZE, not just the current one.)

Unblock https://github.com/facebook/rocksdb/issues/5932
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6153

Test Plan:
ran unit test with builds TEST_CACHE_LINE_SIZE=128, =256, and
unset (64 on Intel)

Differential Revision: D18936015

Pulled By: pdillinger

fbshipit-source-id: e5e3852f95283d34d624632c1ae8d3adb2f2662c
main
Peter Dillinger 5 years ago committed by Facebook Github Bot
parent 3717a88289
commit d0ad3c59d8
  1. 21
      db/c_test.c

@ -1121,14 +1121,21 @@ int main(int argc, char** argv) {
CheckGet(db, roptions, keybuf, NULL);
}
// Other than the first value, these are essentially fingerprints of
// the underlying Bloom filter schemas.
static const int expected_hits[] = {5000, 241, 224};
CheckCondition(
expected_hits[run] ==
(int)rocksdb_perfcontext_metric(perf, rocksdb_bloom_sst_hit_count));
const int hits =
(int)rocksdb_perfcontext_metric(perf, rocksdb_bloom_sst_hit_count);
if (run == 0) {
// Due to half true, half false with fake filter result
CheckCondition(hits == keys_to_query / 2);
} else if (run == 1) {
// Essentially a fingerprint of the block-based Bloom schema
CheckCondition(hits == 241);
} else {
// Essentially a fingerprint of the full Bloom schema(s),
// format_version < 5, which vary for three different CACHE_LINE_SIZEs
CheckCondition(hits == 224 || hits == 180 || hits == 125);
}
CheckCondition(
(keys_to_query - expected_hits[run]) ==
(keys_to_query - hits) ==
(int)rocksdb_perfcontext_metric(perf, rocksdb_bloom_sst_miss_count));
rocksdb_perfcontext_destroy(perf);

Loading…
Cancel
Save