]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Clear saved value in DBIter::{Next, Prev} (#10934)
authorLevi Tamasi <ltamasi@fb.com>
Tue, 8 Nov 2022 22:49:16 +0000 (14:49 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 8 Nov 2022 22:49:16 +0000 (14:49 -0800)
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

db/db_iter.cc

index 6f8319910b3e62545468b7b97d7a0bb5d129b988..9a130700515d9cc5472ee48e5827e7973000446c 100644 (file)
@@ -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);