Skip to content

Commit 9b8a2b5

Browse files
committed
No prefix iterator in db_stress
Summary: We're trying to deprecate prefix iterators, so no need to test them in db_stress Test Plan: ran it Reviewers: ljin Reviewed By: ljin CC: leveldb Differential Revision: https://reviews.facebook.net/D16917
1 parent c61c983 commit 9b8a2b5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tools/db_stress.cc

+5-6
Original file line numberDiff line numberDiff line change
@@ -952,10 +952,10 @@ class StressTest {
952952
prefixes[i].resize(FLAGS_prefix_size);
953953
prefix_slices[i] = Slice(prefixes[i]);
954954
readoptionscopy[i] = readoptions;
955-
readoptionscopy[i].prefix = &prefix_slices[i];
955+
readoptionscopy[i].prefix_seek = true;
956956
readoptionscopy[i].snapshot = snapshot;
957957
iters[i] = db_->NewIterator(readoptionscopy[i]);
958-
iters[i]->SeekToFirst();
958+
iters[i]->Seek(prefix_slices[i]);
959959
}
960960

961961
int count = 0;
@@ -1103,11 +1103,11 @@ class StressTest {
11031103
// prefix
11041104
if (!FLAGS_test_batches_snapshots) {
11051105
Slice prefix = Slice(key.data(), FLAGS_prefix_size);
1106-
read_opts.prefix = &prefix;
1106+
read_opts.prefix_seek = true;
11071107
Iterator* iter = db_->NewIterator(read_opts);
11081108
int64_t count = 0;
1109-
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
1110-
assert(iter->key().starts_with(prefix));
1109+
for (iter->Seek(prefix);
1110+
iter->Valid() && iter->key().starts_with(prefix); iter->Next()) {
11111111
++count;
11121112
}
11131113
assert(count <=
@@ -1121,7 +1121,6 @@ class StressTest {
11211121
} else {
11221122
MultiPrefixScan(thread, read_opts, key);
11231123
}
1124-
read_opts.prefix = nullptr;
11251124
} else if (prefixBound <= prob_op && prob_op < writeBound) {
11261125
// OPERATION write
11271126
uint32_t value_base = thread->rand.Next();

0 commit comments

Comments
 (0)