diff --git a/table/merging_iterator.cc b/table/merging_iterator.cc index ae92aa19830..505cd76d386 100644 --- a/table/merging_iterator.cc +++ b/table/merging_iterator.cc @@ -308,6 +308,7 @@ class MergingIterator : public InternalIterator { // holds after this call, and minHeap_.top().iter points to the // first key >= target among children_ that is not covered by any range // tombstone. + status_ = Status::OK(); SeekImpl(target); FindNextVisibleKey(); @@ -321,6 +322,7 @@ class MergingIterator : public InternalIterator { void SeekForPrev(const Slice& target) override { assert(range_tombstone_iters_.empty() || range_tombstone_iters_.size() == children_.size()); + status_ = Status::OK(); SeekForPrevImpl(target); FindPrevVisibleKey(); @@ -798,7 +800,6 @@ void MergingIterator::SeekImpl(const Slice& target, size_t starting_level, active_.erase(active_.lower_bound(starting_level), active_.end()); } - status_ = Status::OK(); IterKey current_search_key; current_search_key.SetInternalKey(target, false /* copy */); // Seek target might change to some range tombstone end key, so @@ -1083,7 +1084,6 @@ void MergingIterator::SeekForPrevImpl(const Slice& target, active_.erase(active_.lower_bound(starting_level), active_.end()); } - status_ = Status::OK(); IterKey current_search_key; current_search_key.SetInternalKey(target, false /* copy */); // Seek target might change to some range tombstone end key, so diff --git a/unreleased_history/bug_fixes/010_check_more_iter_status_for_delete_range.md b/unreleased_history/bug_fixes/010_check_more_iter_status_for_delete_range.md new file mode 100644 index 00000000000..3e060b658b4 --- /dev/null +++ b/unreleased_history/bug_fixes/010_check_more_iter_status_for_delete_range.md @@ -0,0 +1 @@ +* Fix a bug where iterator may return incorrect result for DeleteRange() users if there was an error reading from a file. \ No newline at end of file