diff --git a/db/db_impl.cc b/db/db_impl.cc index 796b73547..c0d8440dd 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1238,7 +1238,7 @@ Status DBImpl::WriteLevel0Table(ColumnFamilyData* cfd, (unsigned long)m->GetNextLogNumber()); memtables.push_back(m->NewIterator()); } - Iterator* iter = NewMergingIterator(env_, &cfd->internal_comparator(), + Iterator* iter = NewMergingIterator(&cfd->internal_comparator(), &memtables[0], memtables.size()); Log(options_.info_log, "Level-0 flush table #%lu: started", (unsigned long)meta.number); @@ -3211,9 +3211,8 @@ Iterator* DBImpl::NewInternalIterator(const ReadOptions& options, // Collect iterators for files in L0 - Ln super_version->current->AddIterators(options, storage_options_, &iterator_list); - Iterator* internal_iter = - NewMergingIterator(env_, &cfd->internal_comparator(), &iterator_list[0], - iterator_list.size()); + Iterator* internal_iter = NewMergingIterator( + &cfd->internal_comparator(), &iterator_list[0], iterator_list.size()); IterState* cleanup = new IterState(this, &mutex_, super_version); internal_iter->RegisterCleanup(CleanupIteratorState, cleanup, nullptr); @@ -3262,8 +3261,8 @@ std::pair DBImpl::GetTailingIteratorPair( std::vector list; super_version->imm->AddIterators(options, &list); super_version->current->AddIterators(options, storage_options_, &list); - Iterator* immutable_iter = NewMergingIterator( - env_, &cfd->internal_comparator(), &list[0], list.size()); + Iterator* immutable_iter = + NewMergingIterator(&cfd->internal_comparator(), &list[0], list.size()); // create a DBIter that only uses memtable content; see NewIterator() immutable_iter = diff --git a/db/version_set.cc b/db/version_set.cc index d6c6b5772..84361f5ff 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2617,7 +2617,7 @@ Iterator* VersionSet::MakeInputIterator(Compaction* c) { } assert(num <= space); Iterator* result = NewMergingIterator( - env_, &c->column_family_data()->internal_comparator(), list, num); + &c->column_family_data()->internal_comparator(), list, num); delete[] list; return result; } diff --git a/table/merger.cc b/table/merger.cc index 6e31f8db0..7799a0cc4 100644 --- a/table/merger.cc +++ b/table/merger.cc @@ -25,16 +25,14 @@ namespace { class MergingIterator : public Iterator { public: - MergingIterator(Env* const env, const Comparator* comparator, - Iterator** children, int n) + MergingIterator(const Comparator* comparator, Iterator** children, int n) : comparator_(comparator), children_(n), current_(nullptr), use_heap_(true), - env_(env), direction_(kForward), maxHeap_(NewMaxIterHeap(comparator_)), - minHeap_ (NewMinIterHeap(comparator_)) { + minHeap_(NewMinIterHeap(comparator_)) { for (int i = 0; i < n; i++) { children_[i].Set(children[i]); } @@ -230,7 +228,6 @@ class MergingIterator : public Iterator { // 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? enum Direction { kForward, diff --git a/table/merger.h b/table/merger.h index ea8daa770..3a1a4feb8 100644 --- a/table/merger.h +++ b/table/merger.h @@ -23,8 +23,7 @@ class Env; // key is present in K child iterators, it will be yielded K times. // // REQUIRES: n >= 0 -extern Iterator* NewMergingIterator(Env* const env, - const Comparator* comparator, +extern Iterator* NewMergingIterator(const Comparator* comparator, Iterator** children, int n); } // namespace rocksdb