Add status checks during DB::Open (#6380)

Summary:
Several statuses were not checked during DB::Open.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6380

Test Plan: make check

Differential Revision: D19780237

Pulled By: cheng-chang

fbshipit-source-id: c8d189d20344bd1607890dd1449345bda2ef96b9
This commit is contained in:
Cheng Chang 2020-02-07 12:29:41 -08:00 committed by Facebook Github Bot
parent f361cedf06
commit 0a74e1b958

View file

@ -442,19 +442,19 @@ Status DBImpl::Recover(
assert(s.IsIOError()); assert(s.IsIOError());
return s; return s;
} }
GetDbIdentityFromIdentityFile(&db_id_); s = GetDbIdentityFromIdentityFile(&db_id_);
if (immutable_db_options_.write_dbid_to_manifest) { if (immutable_db_options_.write_dbid_to_manifest && s.ok()) {
VersionEdit edit; VersionEdit edit;
edit.SetDBId(db_id_); edit.SetDBId(db_id_);
Options options; Options options;
MutableCFOptions mutable_cf_options(options); MutableCFOptions mutable_cf_options(options);
versions_->db_id_ = db_id_; versions_->db_id_ = db_id_;
versions_->LogAndApply(versions_->GetColumnFamilySet()->GetDefault(), s = versions_->LogAndApply(versions_->GetColumnFamilySet()->GetDefault(),
mutable_cf_options, &edit, &mutex_, nullptr, mutable_cf_options, &edit, &mutex_, nullptr,
false); false);
} }
} else { } else {
SetIdentityFile(env_, dbname_, db_id_); s = SetIdentityFile(env_, dbname_, db_id_);
} }
if (immutable_db_options_.paranoid_checks && s.ok()) { if (immutable_db_options_.paranoid_checks && s.ok()) {
@ -474,6 +474,7 @@ Status DBImpl::Recover(
s = InitPersistStatsColumnFamily(); s = InitPersistStatsColumnFamily();
} }
if (s.ok()) {
// Initial max_total_in_memory_state_ before recovery logs. Log recovery // Initial max_total_in_memory_state_ before recovery logs. Log recovery
// may check this value to decide whether to flush. // may check this value to decide whether to flush.
max_total_in_memory_state_ = 0; max_total_in_memory_state_ = 0;
@ -483,7 +484,6 @@ Status DBImpl::Recover(
mutable_cf_options->max_write_buffer_number; mutable_cf_options->max_write_buffer_number;
} }
if (s.ok()) {
SequenceNumber next_sequence(kMaxSequenceNumber); SequenceNumber next_sequence(kMaxSequenceNumber);
default_cf_handle_ = new ColumnFamilyHandleImpl( default_cf_handle_ = new ColumnFamilyHandleImpl(
versions_->GetColumnFamilySet()->GetDefault(), this, &mutex_); versions_->GetColumnFamilySet()->GetDefault(), this, &mutex_);