diff --git a/.arcconfig b/.arcconfig index fe8c5aff75..8d6d65afb2 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,10 +1,5 @@ { "project_id" : "leveldb", "conduit_uri" : "https://reviews.facebook.net/", - "copyright_holder" : "", - "load" : [ - "linters/src/" - ], - "lint_engine" : "FacebookFbcodeLintEngine", - "lint.engine.single.linter" : "FbcodeCppLinter" + "copyright_holder" : "" } diff --git a/db/db_impl.cc b/db/db_impl.cc index ff45962f76..700be1e8b6 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -512,31 +512,33 @@ Status DBImpl::Recover(VersionEdit* edit, bool no_log_recory, // Ignore error from CreateDir since the creation of the DB is // committed only when the descriptor is created, and this directory // may already exist from a previous failed creation attempt. - env_->CreateDir(dbname_); assert(db_lock_ == NULL); - Status s = env_->LockFile(LockFileName(dbname_), &db_lock_); - if (!s.ok()) { - return s; - } + if (!no_log_recory) { + env_->CreateDir(dbname_); + Status s = env_->LockFile(LockFileName(dbname_), &db_lock_); + if (!s.ok()) { + return s; + } - if (!env_->FileExists(CurrentFileName(dbname_))) { - if (options_.create_if_missing) { - s = NewDB(); - if (!s.ok()) { - return s; + if (!env_->FileExists(CurrentFileName(dbname_))) { + if (options_.create_if_missing) { + s = NewDB(); + if (!s.ok()) { + return s; + } + } else { + return Status::InvalidArgument( + dbname_, "does not exist (create_if_missing is false)"); } } else { - return Status::InvalidArgument( - dbname_, "does not exist (create_if_missing is false)"); - } - } else { - if (options_.error_if_exists) { - return Status::InvalidArgument( - dbname_, "exists (error_if_exists is true)"); + if (options_.error_if_exists) { + return Status::InvalidArgument( + dbname_, "exists (error_if_exists is true)"); + } } } - s = versions_->Recover(); + Status s = versions_->Recover(); if (s.ok()) { SequenceNumber max_sequence(0); @@ -897,9 +899,12 @@ Status DBImpl::GetUpdatesSince(SequenceNumber seq, return s; } // list wal files in archive dir. - s = ListAllWALFiles(ArchivalDirectory(dbname_), &walFiles, kArchivedLogFile); - if (!s.ok()) { - return s; + std::string archivedir = ArchivalDirectory(dbname_); + if (env_->FileExists(archivedir)) { + s = ListAllWALFiles(archivedir, &walFiles, kArchivedLogFile); + if (!s.ok()) { + return s; + } } if (walFiles.empty()) { diff --git a/db/transaction_log_iterator_impl.cc b/db/transaction_log_iterator_impl.cc index c2ca14a366..bc118b8c2c 100644 --- a/db/transaction_log_iterator_impl.cc +++ b/db/transaction_log_iterator_impl.cc @@ -16,8 +16,8 @@ TransactionLogIteratorImpl::TransactionLogIteratorImpl( isValid_(true), currentFileIndex_(0), currentLogReader_(NULL) { - assert( files_ != NULL); - } + assert( files_ != NULL); +} LogReporter TransactionLogIteratorImpl::NewLogReporter(const uint64_t logNumber) { diff --git a/include/leveldb/write_batch.h b/include/leveldb/write_batch.h index ac0e2e11d5..6546cadaa6 100644 --- a/include/leveldb/write_batch.h +++ b/include/leveldb/write_batch.h @@ -51,9 +51,12 @@ class WriteBatch { }; Status Iterate(Handler* handler) const; - // Returns the serialized string + // Retrive the serialized version of this batch. std::string Data() { return rep_; } + // Constructor with a serialized string object + WriteBatch(std::string rep): rep_(rep) {} + private: friend class WriteBatchInternal;