Revert "Fix for the weird behaviour encountered by ldb Get where it could read only the second-latest value"

This reverts commit 4c696ed001.
main
amayank 12 years ago
parent fd367e677e
commit f3901e0647
  1. 2
      db/db_impl.cc
  2. 4
      db/db_impl_readonly.cc
  3. 4
      util/ldb_cmd.h

@ -160,7 +160,7 @@ DBImpl::DBImpl(const Options& options, const std::string& dbname)
stall_level0_num_files_(0), stall_level0_num_files_(0),
stall_leveln_slowdown_(0), stall_leveln_slowdown_(0),
started_at_(options.env->NowMicros()), started_at_(options.env->NowMicros()),
flush_on_destroy_(true), flush_on_destroy_(false),
delayed_writes_(0) { delayed_writes_(0) {
mem_->Ref(); mem_->Ref();

@ -65,9 +65,7 @@ Iterator* DBImplReadOnly::NewIterator(const ReadOptions& options) {
NewMergingIterator(&internal_comparator_, &list[0], list.size()); NewMergingIterator(&internal_comparator_, &list[0], list.size());
return NewDBIterator( return NewDBIterator(
&dbname_, env_, user_comparator(), internal_iter, &dbname_, env_, user_comparator(), internal_iter,
(options.snapshot != NULL reinterpret_cast<const SnapshotImpl*>(options.snapshot)->number_);
? reinterpret_cast<const SnapshotImpl*>(options.snapshot)->number_
: versions_->LastSequence()));
} }

@ -190,7 +190,9 @@ protected:
// Open the DB. // Open the DB.
leveldb::Status st; leveldb::Status st;
if (is_read_only_) { if (is_read_only_) {
st = leveldb::DB::OpenForReadOnly(opt, db_path_, &db_); //st = leveldb::DB::OpenForReadOnly(opt, db_path_, &db_);
// Could not get this to work
st = leveldb::DB::Open(opt, db_path_, &db_);
} else { } else {
st = leveldb::DB::Open(opt, db_path_, &db_); st = leveldb::DB::Open(opt, db_path_, &db_);
} }

Loading…
Cancel
Save