summaryrefslogtreecommitdiff
path: root/src/mongo/db/startup_recovery.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2020-07-30 17:45:59 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-30 21:58:45 +0000
commitfd4aac328ae7ce54d4d68f43ce30c145d8a63646 (patch)
tree53762978d6109bb796be2e95a02e6931db156a98 /src/mongo/db/startup_recovery.cpp
parent8d14d3a7f10a55acb09cd460157ebe005ca7ae4d (diff)
downloadmongo-fd4aac328ae7ce54d4d68f43ce30c145d8a63646.tar.gz
SERVER-49301 repairDatabasesAndCheckVersion() accepts previous server shutdown state
Diffstat (limited to 'src/mongo/db/startup_recovery.cpp')
-rw-r--r--src/mongo/db/startup_recovery.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mongo/db/startup_recovery.cpp b/src/mongo/db/startup_recovery.cpp
index 9e0e5bed487..80a8376154a 100644
--- a/src/mongo/db/startup_recovery.cpp
+++ b/src/mongo/db/startup_recovery.cpp
@@ -332,8 +332,10 @@ void assertCappedOplog(OperationContext* opCtx, Database* db) {
}
}
-void reconcileCatalogAndRebuildUnfinishedIndexes(OperationContext* opCtx,
- StorageEngine* storageEngine) {
+void reconcileCatalogAndRebuildUnfinishedIndexes(
+ OperationContext* opCtx,
+ StorageEngine* storageEngine,
+ LastStorageEngineShutdownState lastStorageEngineShutdownState) {
auto reconcileResult = fassert(40593, storageEngine->reconcileCatalogAndIdents(opCtx));
// Determine which indexes need to be rebuilt. rebuildIndexesOnCollection() requires that all
@@ -511,7 +513,9 @@ void startupRecoveryReadOnly(OperationContext* opCtx, StorageEngine* storageEngi
}
// Perform routine startup recovery procedure.
-void startupRecovery(OperationContext* opCtx, StorageEngine* storageEngine) {
+void startupRecovery(OperationContext* opCtx,
+ StorageEngine* storageEngine,
+ LastStorageEngineShutdownState lastStorageEngineShutdownState) {
invariant(!storageGlobalParams.readOnly && !storageGlobalParams.repair);
// Determine whether this is a replica set node running in standalone mode. This must be set
@@ -523,7 +527,8 @@ void startupRecovery(OperationContext* opCtx, StorageEngine* storageEngine) {
// Drops abandoned idents. Rebuilds unfinished indexes and restarts incomplete two-phase
// index builds.
- reconcileCatalogAndRebuildUnfinishedIndexes(opCtx, storageEngine);
+ reconcileCatalogAndRebuildUnfinishedIndexes(
+ opCtx, storageEngine, lastStorageEngineShutdownState);
const auto& replSettings = repl::ReplicationCoordinator::get(opCtx)->getSettings();
@@ -563,7 +568,8 @@ namespace startup_recovery {
* Recovers or repairs all databases from a previous shutdown. May throw a MustDowngrade error
* if data files are incompatible with the current binary version.
*/
-void repairAndRecoverDatabases(OperationContext* opCtx) {
+void repairAndRecoverDatabases(OperationContext* opCtx,
+ LastStorageEngineShutdownState lastStorageEngineShutdownState) {
auto const storageEngine = opCtx->getServiceContext()->getStorageEngine();
Lock::GlobalWrite lk(opCtx);
@@ -579,7 +585,7 @@ void repairAndRecoverDatabases(OperationContext* opCtx) {
} else if (storageGlobalParams.readOnly) {
startupRecoveryReadOnly(opCtx, storageEngine);
} else {
- startupRecovery(opCtx, storageEngine);
+ startupRecovery(opCtx, storageEngine, lastStorageEngineShutdownState);
}
assertFilesCompatible(opCtx, storageEngine);