diff --git a/db/db_tailing_iter_test.cc b/db/db_tailing_iter_test.cc index 9bce29a43d..93f12a76d0 100644 --- a/db/db_tailing_iter_test.cc +++ b/db/db_tailing_iter_test.cc @@ -121,7 +121,12 @@ TEST_F(DBTestTailingIterator, TailingIteratorSeekToNext) { } TEST_F(DBTestTailingIterator, TailingIteratorTrimSeekToNext) { - CreateAndReopenWithCF({"pikachu"}, CurrentOptions()); + const uint64_t k20KB = 20 * 1024; + Options options; + options.write_buffer_size = k20KB; + options.max_write_buffer_number = 6; + options.min_write_buffer_number_to_merge = 5; + CreateAndReopenWithCF({"pikachu"}, options); ReadOptions read_options; read_options.tailing = true; diff --git a/db/forward_iterator.cc b/db/forward_iterator.cc index 2522f56e74..ea493060bc 100644 --- a/db/forward_iterator.cc +++ b/db/forward_iterator.cc @@ -238,20 +238,11 @@ void ForwardIterator::SeekInternal(const Slice& internal_key, } for (size_t i = 0; i < imm_iters_.size(); i++) { auto* m = imm_iters_[i]; - if (!m) { - continue; - } seek_to_first ? m->SeekToFirst() : m->Seek(internal_key); if (!m->status().ok()) { immutable_status_ = m->status(); } else if (m->Valid()) { - if (!IsOverUpperBound(m->key())) { - immutable_min_heap_.push(m); - } else { - has_iter_trimmed_for_upper_bound_ = true; - delete m; - imm_iters_[i] = nullptr; - } + immutable_min_heap_.push(m); } } @@ -624,19 +615,6 @@ bool ForwardIterator::NeedToRebuildTrimmed(const Slice& target) { } void ForwardIterator::DeleteCurrentIter() { - for (size_t i = 0; i < imm_iters_.size(); i++) { - auto& m = imm_iters_[i]; - if (!m) { - continue; - } - if (m == current_) { - has_iter_trimmed_for_upper_bound_ = true; - delete m; - m = nullptr; - return; - } - } - const VersionStorageInfo* vstorage = sv_->current->storage_info(); const std::vector& l0 = vstorage->LevelFiles(0); for (uint32_t i = 0; i < l0.size(); ++i) { @@ -667,12 +645,6 @@ bool ForwardIterator::TEST_CheckDeletedIters() { if (!has_iter_trimmed_for_upper_bound_) { return false; } - for (size_t i = 0; i < imm_iters_.size(); i++) { - auto& m = imm_iters_[i]; - if (!m) { - return true; - } - } const VersionStorageInfo* vstorage = sv_->current->storage_info(); const std::vector& l0 = vstorage->LevelFiles(0);