From b560fc9f625d7002631b7709188bc8f1151288c2 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Thu, 8 Mar 2018 10:09:59 -0800 Subject: [PATCH] Fix a block pinning regression introduced in b555ed30a4a93b80a3ac4781c6721ab988e03b5b Summary: b555ed30a4a93b80a3ac4781c6721ab988e03b5b introduces a regression, which causes blocks always to be pinned in block based iterators. Fix it. Closes https://github.com/facebook/rocksdb/pull/3582 Differential Revision: D7189534 Pulled By: siying fbshipit-source-id: 117dc7a03d0a0e360424db02efb366e12da2be03 --- table/block_based_table_reader.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/table/block_based_table_reader.h b/table/block_based_table_reader.h index 08b0bec7e..f2c5082af 100644 --- a/table/block_based_table_reader.h +++ b/table/block_based_table_reader.h @@ -545,9 +545,10 @@ class BlockBasedTableIterator : public InternalIterator { } bool IsKeyPinned() const override { return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() && - block_iter_points_to_real_block_; + block_iter_points_to_real_block_ && data_block_iter_.IsKeyPinned(); } bool IsValuePinned() const override { + // BlockIter::IsValuePinned() is always true. No need to check return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() && block_iter_points_to_real_block_; } @@ -566,7 +567,7 @@ class BlockBasedTableIterator : public InternalIterator { void ResetDataIter() { if (block_iter_points_to_real_block_) { - if (pinned_iters_mgr_ != nullptr) { + if (pinned_iters_mgr_ != nullptr && pinned_iters_mgr_->PinningEnabled()) { data_block_iter_.DelegateCleanupsTo(pinned_iters_mgr_); } data_block_iter_.~BlockIter();