Fix a block pinning regression introduced in b555ed30a4

Summary:
b555ed30a4 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
main
Siying Dong 7 years ago committed by Facebook Github Bot
parent e69f6e8629
commit b560fc9f62
  1. 5
      table/block_based_table_reader.h

@ -545,9 +545,10 @@ class BlockBasedTableIterator : public InternalIterator {
} }
bool IsKeyPinned() const override { bool IsKeyPinned() const override {
return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() && 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 { bool IsValuePinned() const override {
// BlockIter::IsValuePinned() is always true. No need to check
return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() && return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() &&
block_iter_points_to_real_block_; block_iter_points_to_real_block_;
} }
@ -566,7 +567,7 @@ class BlockBasedTableIterator : public InternalIterator {
void ResetDataIter() { void ResetDataIter() {
if (block_iter_points_to_real_block_) { 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_.DelegateCleanupsTo(pinned_iters_mgr_);
} }
data_block_iter_.~BlockIter(); data_block_iter_.~BlockIter();

Loading…
Cancel
Save