Stress Test: relax prefix iterator check condition (#6269)

Summary:
Right now, when validating prefix iterator, if control iterator is invalidate but prefix iterator shows value, we determine it as a test failure. However, this fails to consider the case where a file or memtable containing a tombstone is filtered out by a prefix bloom filter. The fix is to relax the check in this case. If we are out of prefix range, then ignore the check.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6269

Test Plan: Run crash_test for a short while and it still passes.

Differential Revision: D19317594

fbshipit-source-id: b964a1cdc1df5efe439d4b32f8023e1fbc8598c1
main
sdong 5 years ago committed by Facebook Github Bot
parent f4a378be3e
commit 1244abef66
  1. 22
      db_stress_tool/db_stress_test_base.cc

@ -1040,7 +1040,26 @@ void StressTest::VerifyIterator(ThreadState* thread,
return;
}
const SliceTransform* pe =
ro.total_order_seek ? nullptr : options_.prefix_extractor.get();
const Comparator* cmp = options_.comparator;
if (iter->Valid() && !cmp_iter->Valid()) {
if (pe != nullptr) {
if (!pe->InDomain(seek_key)) {
// Prefix seek a non-in-domain key is undefined. Skip checking for
// this scenario.
*diverged = true;
return;
} else if (!pe->InDomain(iter->key())) {
// out of range is iterator key is not in domain anymore.
*diverged = true;
return;
} else if (pe->Transform(iter->key()) != pe->Transform(seek_key)) {
*diverged = true;
return;
}
}
fprintf(stderr,
"Control interator is invalid but iterator has key %s "
"%s\n",
@ -1051,9 +1070,6 @@ void StressTest::VerifyIterator(ThreadState* thread,
// Iterator is not valid. It can be legimate if it has already been
// out of upper or lower bound, or filtered out by prefix iterator.
const Slice& total_order_key = cmp_iter->key();
const SliceTransform* pe =
ro.total_order_seek ? nullptr : options_.prefix_extractor.get();
const Comparator* cmp = options_.comparator;
if (pe != nullptr) {
if (!pe->InDomain(seek_key)) {

Loading…
Cancel
Save