提交 f0ee2356 编写于 作者: S sdong

Fix issue with iterator operations in this order: Prev(), Seek(), Prev()

Summary:
Due to a bad merge of D14163 and D14001 before checking in D14001, "direction_ = kForward;" in MergeIterator::Seek() was deleted my mistake (in commit b135d01e ). It will generate wrong results or assert failure after the sequence of Prev() (or SeekToLast()), Seek() and Prev().

Fix it

Test Plan: make all check

Reviewers: igor, haobo, dhruba

Reviewed By: igor

CC: yhchiang, i.am.jin.lei, ljin, leveldb

Differential Revision: https://reviews.facebook.net/D16527
上级 5142b370
......@@ -122,6 +122,7 @@ class MergingIterator : public Iterator {
// one, or null if there is no first child.
current_ = first_child;
}
direction_ = kForward;
}
virtual void Next() {
......@@ -228,6 +229,8 @@ class MergingIterator : public Iterator {
// If the value is true, both of iterators in the heap and current_
// contain valid rows. If it is false, only current_ can possibly contain
// valid rows.
// This flag is always true for reverse direction, as we always use heap for
// the reverse iterating case.
bool use_heap_;
Env* const env_;
// Which direction is the iterator moving?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册