Clear saved value in DBIter::{Next, Prev} (#10934)

Summary:
`DBIter::saved_value_` stores the result of any `Merge` that was performed to compute the iterator's current value. This value can be ditched whenever the iterator's position is changed, and is already cleared in `Seek`, `SeekForPrev`, `SeekToFirst`, and `SeekToLast`. With the patch, it is also cleared in `Next` and `Prev`.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10934

Test Plan: `make check`

Reviewed By: akankshamahajan15

Differential Revision: D41133473

Pulled By: ltamasi

fbshipit-source-id: cf9e936f48151e64e455cc1664d6e9f4a03aa308
main
Levi Tamasi 2 years ago committed by Facebook GitHub Bot
parent 55d58d91e7
commit c62f322169
  1. 4
      db/db_iter.cc

@ -158,6 +158,8 @@ void DBIter::Next() {
local_stats_.next_count_++;
if (ok && iter_.Valid()) {
ClearSavedValue();
if (prefix_same_as_start_) {
assert(prefix_extractor_ != nullptr);
const Slice prefix = prefix_.GetUserKey();
@ -636,6 +638,8 @@ void DBIter::Prev() {
}
}
if (ok) {
ClearSavedValue();
Slice prefix;
if (prefix_same_as_start_) {
assert(prefix_extractor_ != nullptr);

Loading…
Cancel
Save