Skip to content

Commit 02a2cb1

Browse files
author
Lei Jin
committed
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
1 parent 86926d8 commit 02a2cb1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/db_stress.cc

+8-2
Original file line numberDiff line numberDiff line change
@@ -1181,11 +1181,18 @@ class StressTest {
11811181
if (thread->tid == shared.GetNumThreads() - 1) {
11821182
end = max_key;
11831183
}
1184+
11841185
if (!thread->rand.OneIn(2)) {
1186+
options.prefix_seek = FLAGS_prefix_size > 0;
11851187
// Use iterator to verify this range
11861188
unique_ptr<Iterator> iter(db_->NewIterator(options));
11871189
iter->Seek(Key(start));
11881190
for (long i = start; i < end; i++) {
1191+
// TODO(ljin): update "long" to uint64_t
1192+
// Reseek when the prefix changes
1193+
if (i % (static_cast<int64_t>(1) << 8 * (8 - FLAGS_prefix_size)) == 0) {
1194+
iter->Seek(Key(i));
1195+
}
11891196
std::string from_db;
11901197
std::string keystr = Key(i);
11911198
Slice k = keystr;
@@ -1209,8 +1216,7 @@ class StressTest {
12091216
PrintKeyValue(i, from_db.data(), from_db.length());
12101217
}
12111218
}
1212-
}
1213-
else {
1219+
} else {
12141220
// Use Get to verify this range
12151221
for (long i = start; i < end; i++) {
12161222
std::string from_db;

0 commit comments

Comments
 (0)