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
This commit is contained in:
sdong 2020-01-08 13:30:51 -08:00 committed by Facebook Github Bot
parent f4a378be3e
commit 1244abef66

View File

@ -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)) {