From 02a2cb139bca84bb6b1bb6143c34ab17cda2fd40 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Wed, 12 Mar 2014 22:20:22 -0700 Subject: [PATCH] fix VerifyDb in StressTest Summary: this should fix the hash_skip_list issue, but I still see seqno assertion failure in the last run. Will continue investigating and address that in a different diff Test Plan: make whitebox_crash_test Reviewers: igor Reviewed By: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D16851 --- tools/db_stress.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 47ba127756..f17a8a48fb 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -1181,11 +1181,18 @@ class StressTest { if (thread->tid == shared.GetNumThreads() - 1) { end = max_key; } + if (!thread->rand.OneIn(2)) { + options.prefix_seek = FLAGS_prefix_size > 0; // Use iterator to verify this range unique_ptr iter(db_->NewIterator(options)); iter->Seek(Key(start)); for (long i = start; i < end; i++) { + // TODO(ljin): update "long" to uint64_t + // Reseek when the prefix changes + if (i % (static_cast(1) << 8 * (8 - FLAGS_prefix_size)) == 0) { + iter->Seek(Key(i)); + } std::string from_db; std::string keystr = Key(i); Slice k = keystr; @@ -1209,8 +1216,7 @@ class StressTest { PrintKeyValue(i, from_db.data(), from_db.length()); } } - } - else { + } else { // Use Get to verify this range for (long i = start; i < end; i++) { std::string from_db;