Remove env_ from MergingIterator

Summary: env_ is not used. Compiling for iOS complains.

Test Plan: compiles now

Reviewers: ljin, haobo, sdong, dhruba

Reviewed By: ljin

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17589
main
Igor Canadi 11 years ago
parent 0c1126d4cf
commit 5b345b76cb
  1. 11
      db/db_impl.cc
  2. 2
      db/version_set.cc
  3. 7
      table/merger.cc
  4. 3
      table/merger.h

@ -1238,7 +1238,7 @@ Status DBImpl::WriteLevel0Table(ColumnFamilyData* cfd,
(unsigned long)m->GetNextLogNumber()); (unsigned long)m->GetNextLogNumber());
memtables.push_back(m->NewIterator()); memtables.push_back(m->NewIterator());
} }
Iterator* iter = NewMergingIterator(env_, &cfd->internal_comparator(), Iterator* iter = NewMergingIterator(&cfd->internal_comparator(),
&memtables[0], memtables.size()); &memtables[0], memtables.size());
Log(options_.info_log, "Level-0 flush table #%lu: started", Log(options_.info_log, "Level-0 flush table #%lu: started",
(unsigned long)meta.number); (unsigned long)meta.number);
@ -3211,9 +3211,8 @@ Iterator* DBImpl::NewInternalIterator(const ReadOptions& options,
// Collect iterators for files in L0 - Ln // Collect iterators for files in L0 - Ln
super_version->current->AddIterators(options, storage_options_, super_version->current->AddIterators(options, storage_options_,
&iterator_list); &iterator_list);
Iterator* internal_iter = Iterator* internal_iter = NewMergingIterator(
NewMergingIterator(env_, &cfd->internal_comparator(), &iterator_list[0], &cfd->internal_comparator(), &iterator_list[0], iterator_list.size());
iterator_list.size());
IterState* cleanup = new IterState(this, &mutex_, super_version); IterState* cleanup = new IterState(this, &mutex_, super_version);
internal_iter->RegisterCleanup(CleanupIteratorState, cleanup, nullptr); internal_iter->RegisterCleanup(CleanupIteratorState, cleanup, nullptr);
@ -3262,8 +3261,8 @@ std::pair<Iterator*, Iterator*> DBImpl::GetTailingIteratorPair(
std::vector<Iterator*> list; std::vector<Iterator*> list;
super_version->imm->AddIterators(options, &list); super_version->imm->AddIterators(options, &list);
super_version->current->AddIterators(options, storage_options_, &list); super_version->current->AddIterators(options, storage_options_, &list);
Iterator* immutable_iter = NewMergingIterator( Iterator* immutable_iter =
env_, &cfd->internal_comparator(), &list[0], list.size()); NewMergingIterator(&cfd->internal_comparator(), &list[0], list.size());
// create a DBIter that only uses memtable content; see NewIterator() // create a DBIter that only uses memtable content; see NewIterator()
immutable_iter = immutable_iter =

@ -2617,7 +2617,7 @@ Iterator* VersionSet::MakeInputIterator(Compaction* c) {
} }
assert(num <= space); assert(num <= space);
Iterator* result = NewMergingIterator( Iterator* result = NewMergingIterator(
env_, &c->column_family_data()->internal_comparator(), list, num); &c->column_family_data()->internal_comparator(), list, num);
delete[] list; delete[] list;
return result; return result;
} }

@ -25,16 +25,14 @@ namespace {
class MergingIterator : public Iterator { class MergingIterator : public Iterator {
public: public:
MergingIterator(Env* const env, const Comparator* comparator, MergingIterator(const Comparator* comparator, Iterator** children, int n)
Iterator** children, int n)
: comparator_(comparator), : comparator_(comparator),
children_(n), children_(n),
current_(nullptr), current_(nullptr),
use_heap_(true), use_heap_(true),
env_(env),
direction_(kForward), direction_(kForward),
maxHeap_(NewMaxIterHeap(comparator_)), maxHeap_(NewMaxIterHeap(comparator_)),
minHeap_ (NewMinIterHeap(comparator_)) { minHeap_(NewMinIterHeap(comparator_)) {
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
children_[i].Set(children[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 // This flag is always true for reverse direction, as we always use heap for
// the reverse iterating case. // the reverse iterating case.
bool use_heap_; bool use_heap_;
Env* const env_;
// Which direction is the iterator moving? // Which direction is the iterator moving?
enum Direction { enum Direction {
kForward, kForward,

@ -23,8 +23,7 @@ class Env;
// key is present in K child iterators, it will be yielded K times. // key is present in K child iterators, it will be yielded K times.
// //
// REQUIRES: n >= 0 // REQUIRES: n >= 0
extern Iterator* NewMergingIterator(Env* const env, extern Iterator* NewMergingIterator(const Comparator* comparator,
const Comparator* comparator,
Iterator** children, int n); Iterator** children, int n);
} // namespace rocksdb } // namespace rocksdb

Loading…
Cancel
Save