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
This commit is contained in:
Siying Dong 2018-03-08 10:09:59 -08:00 committed by Facebook Github Bot
parent e69f6e8629
commit b560fc9f62

View File

@ -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();