Skip to content

Commit

Permalink
db_bench: fix SeekRandomWriteRandom valid check (#652)
Browse files Browse the repository at this point in the history
Use key and value only after checking iterator is valid
  • Loading branch information
Yuval-Ariel authored Aug 29, 2023
1 parent a53332d commit 4209cf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Enhancements

### Bug Fixes
db_bench: fix SeekRandomWriteRandom valid check. Use key and value only after checking iterator is valid.

### Miscellaneous

Expand Down
3 changes: 2 additions & 1 deletion tools/db_bench_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8083,13 +8083,14 @@ class Benchmark {
}

for (int j = 0; j < FLAGS_seek_nexts && iter_to_use->Valid(); ++j) {
bytes += iter_to_use->key().size() + iter_to_use->value().size();

if (!FLAGS_reverse_iterator) {
iter_to_use->Next();
} else {
iter_to_use->Prev();
}
assert(iter_to_use->status().ok());
bytes += iter_to_use->key().size() + iter_to_use->value().size();
}

if (seeks % 256 == 255) {
Expand Down

0 comments on commit 4209cf5

Please sign in to comment.