From f3901e064789918a7504d7f83505801b22155bcb Mon Sep 17 00:00:00 2001 From: amayank Date: Mon, 18 Feb 2013 22:32:07 -0800 Subject: [PATCH] Revert "Fix for the weird behaviour encountered by ldb Get where it could read only the second-latest value" This reverts commit 4c696ed0018800b62e2448a4ead438255140fc25. --- db/db_impl.cc | 2 +- db/db_impl_readonly.cc | 4 +--- util/ldb_cmd.h | 4 +++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index ce74d62a9..8fb00fd55 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -160,7 +160,7 @@ DBImpl::DBImpl(const Options& options, const std::string& dbname) stall_level0_num_files_(0), stall_leveln_slowdown_(0), started_at_(options.env->NowMicros()), - flush_on_destroy_(true), + flush_on_destroy_(false), delayed_writes_(0) { mem_->Ref(); diff --git a/db/db_impl_readonly.cc b/db/db_impl_readonly.cc index 74809a4e7..72889215d 100644 --- a/db/db_impl_readonly.cc +++ b/db/db_impl_readonly.cc @@ -65,9 +65,7 @@ Iterator* DBImplReadOnly::NewIterator(const ReadOptions& options) { NewMergingIterator(&internal_comparator_, &list[0], list.size()); return NewDBIterator( &dbname_, env_, user_comparator(), internal_iter, - (options.snapshot != NULL - ? reinterpret_cast(options.snapshot)->number_ - : versions_->LastSequence())); + reinterpret_cast(options.snapshot)->number_); } diff --git a/util/ldb_cmd.h b/util/ldb_cmd.h index 63d22f913..aac9905af 100644 --- a/util/ldb_cmd.h +++ b/util/ldb_cmd.h @@ -190,7 +190,9 @@ protected: // Open the DB. leveldb::Status st; 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 { st = leveldb::DB::Open(opt, db_path_, &db_); }