get rid of shared_ptr in memtable.cc

Summary: Get rid of the devil. Probably won't impact anything on the perf side.

Test Plan: make all check

Reviewers: igor, haobo, sdong, yhchiang

Reviewed By: haobo

CC: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D18153
main
Lei Jin 11 years ago
parent 547bb6a626
commit 5f1daf7ae3
  1. 5
      db/memtable.cc

@ -162,7 +162,6 @@ class MemTableIterator: public Iterator {
MemTableIterator(const MemTable& mem, const ReadOptions& options) MemTableIterator(const MemTable& mem, const ReadOptions& options)
: bloom_(nullptr), : bloom_(nullptr),
prefix_extractor_(mem.prefix_extractor_), prefix_extractor_(mem.prefix_extractor_),
iter_(),
valid_(false) { valid_(false) {
if (options.prefix) { if (options.prefix) {
iter_.reset(mem.table_->GetPrefixIterator(*options.prefix)); iter_.reset(mem.table_->GetPrefixIterator(*options.prefix));
@ -217,7 +216,7 @@ class MemTableIterator: public Iterator {
private: private:
DynamicBloom* bloom_; DynamicBloom* bloom_;
const SliceTransform* const prefix_extractor_; const SliceTransform* const prefix_extractor_;
std::shared_ptr<MemTableRep::Iterator> iter_; std::unique_ptr<MemTableRep::Iterator> iter_;
bool valid_; bool valid_;
// No copying allowed // No copying allowed
@ -477,7 +476,7 @@ bool MemTable::UpdateCallback(SequenceNumber seq,
LookupKey lkey(key, seq); LookupKey lkey(key, seq);
Slice memkey = lkey.memtable_key(); Slice memkey = lkey.memtable_key();
std::shared_ptr<MemTableRep::Iterator> iter( std::unique_ptr<MemTableRep::Iterator> iter(
table_->GetIterator(lkey.user_key())); table_->GetIterator(lkey.user_key()));
iter->Seek(lkey.internal_key(), memkey.data()); iter->Seek(lkey.internal_key(), memkey.data());

Loading…
Cancel
Save