]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fix bug in pinned partitioned user key indexes
authorAndrew Kryczka <andrewkr@fb.com>
Mon, 12 Oct 2020 20:43:52 +0000 (13:43 -0700)
committerAndrew Kryczka <andrewkr@fb.com>
Mon, 12 Oct 2020 20:54:35 +0000 (13:54 -0700)
Backports part of 75d3b6fdf0aa1007c4d26382f65be0adf4519a37.

HISTORY.md
table/iterator_wrapper.h
table/two_level_iterator.cc

index c942f1012d5ca09a0cbf9332cbf250ddf944d3a7..b2d855db26bc6c56909da2e1555f7563c3504cbd 100644 (file)
@@ -2,6 +2,7 @@
 ## Unreleased
 ### Bug Fixes
 * Since 6.12, memtable lookup should report unrecognized value_type as corruption (#7121).
+* Fixed a bug in the following combination of features: indexes with user keys (`format_version >= 3`), indexes are partitioned (`index_type == kTwoLevelIndexSearch`), and some index partitions are pinned in memory (`BlockBasedTableOptions::pin_l0_filter_and_index_blocks_in_cache`). The bug could cause keys to be truncated when read from the index leading to wrong read results or other unexpected behavior.
 
 ## 6.13 (09/24/2020)
 ### Bug fixes
index 6444b0a2532311842e739c968c92e392f80d51fd..ff46f2536cbe48e41f49a5edc7ad5205d8c30088 100644 (file)
@@ -149,6 +149,11 @@ class IteratorWrapperBase {
     return result_.value_prepared;
   }
 
+  Slice user_key() const {
+    assert(Valid());
+    return iter_->user_key();
+  }
+
  private:
   void Update() {
     valid_ = iter_->Valid();
index a17d56df5b965e07557db6f0e116224146a804ae..d967deff8e7d4eb5dc824af10ef2cdbe4225d686 100644 (file)
@@ -43,6 +43,10 @@ class TwoLevelIndexIterator : public InternalIteratorBase<IndexValue> {
     assert(Valid());
     return second_level_iter_.key();
   }
+  Slice user_key() const override {
+    assert(Valid());
+    return second_level_iter_.user_key();
+  }
   IndexValue value() const override {
     assert(Valid());
     return second_level_iter_.value();