diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2020-08-06 11:03:31 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-06 20:39:15 +0000 |
commit | 7dde791c6f42b06886de41a379430ef6ef0ffa25 (patch) | |
tree | 2f8c39b0ff4514fb78626dfdc7a22c061c264423 /src/mongo/db/startup_recovery.cpp | |
parent | c02549a7a7c103ba352d90cb33d195ba7cb27455 (diff) | |
download | mongo-7dde791c6f42b06886de41a379430ef6ef0ffa25.tar.gz |
SERVER-50139: Abort repair on FCV initialization errors
Diffstat (limited to 'src/mongo/db/startup_recovery.cpp')
-rw-r--r-- | src/mongo/db/startup_recovery.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/startup_recovery.cpp b/src/mongo/db/startup_recovery.cpp index b2afe36cb13..08c69d42e63 100644 --- a/src/mongo/db/startup_recovery.cpp +++ b/src/mongo/db/startup_recovery.cpp @@ -441,6 +441,10 @@ void startupRepair(OperationContext* opCtx, StorageEngine* storageEngine) { // FCV-dependent features are rebuilt properly. Note that we don't try to prevent // repairDatabase from repairing this collection again, because it only consists of one // document. + // If we fail to load the FCV document due to upgrade problems, we need to abort the repair in + // order to allow downgrading to older binary versions. + auto abortRepairOnFCVErrors = makeGuard( + [&] { StorageRepairObserver::get(opCtx->getServiceContext())->onRepairDone(opCtx); }); if (auto fcvColl = CollectionCatalog::get(opCtx).lookupCollectionByNamespace( opCtx, NamespaceString::kServerConfigurationNamespace)) { auto databaseHolder = DatabaseHolder::get(opCtx); @@ -451,6 +455,7 @@ void startupRepair(OperationContext* opCtx, StorageEngine* storageEngine) { } uassertStatusOK(restoreMissingFeatureCompatibilityVersionDocument(opCtx)); FeatureCompatibilityVersion::initializeForStartup(opCtx); + abortRepairOnFCVErrors.dismiss(); // The local database should be repaired before any other replicated collections so we know // whether not to rebuild unfinished two-phase index builds if this is a replica set node |