From 36409e00162731b94ab3104e70a8d8f091a6ca2a Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 6 Nov 2013 14:11:52 -0800 Subject: [PATCH] Fix slow no-io iterator Summary: This fixes #3130525. Dhruba's suggestion and Tnovak's implementation :) The issue was with SkipEmptyDataBlocksForward(), but I also changed SkipEmptyDataBlocksBackward(). Is that OK? Test Plan: Run the logdevice test Reviewers: dhruba Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D13911 --- table/two_level_iterator.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/table/two_level_iterator.cc b/table/two_level_iterator.cc index 965aa65a1..ac2d8d3d9 100644 --- a/table/two_level_iterator.cc +++ b/table/two_level_iterator.cc @@ -139,7 +139,8 @@ void TwoLevelIterator::Prev() { void TwoLevelIterator::SkipEmptyDataBlocksForward() { - while (data_iter_.iter() == nullptr || !data_iter_.Valid()) { + while (data_iter_.iter() == nullptr || (!data_iter_.Valid() && + !data_iter_.status().IsIncomplete())) { // Move to next block if (!index_iter_.Valid()) { SetDataIterator(nullptr); @@ -152,7 +153,8 @@ void TwoLevelIterator::SkipEmptyDataBlocksForward() { } void TwoLevelIterator::SkipEmptyDataBlocksBackward() { - while (data_iter_.iter() == nullptr || !data_iter_.Valid()) { + while (data_iter_.iter() == nullptr || (!data_iter_.Valid() && + !data_iter_.status().IsIncomplete())) { // Move to next block if (!index_iter_.Valid()) { SetDataIterator(nullptr);