diff options
author | Shin Yee Tan <shinyee.tan@mongodb.com> | 2020-07-14 15:13:10 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-14 15:56:36 +0000 |
commit | 674b8eb2cf067ce3c6fff5e07dc65d4f7e37ea49 (patch) | |
tree | 736b583ba4db53ab48e0be965849a3ce8bcbc797 /src/mongo/db/repair_database.cpp | |
parent | 51604da9f47a7d58a72cf58cbfb28c4a2340642e (diff) | |
download | mongo-674b8eb2cf067ce3c6fff5e07dc65d4f7e37ea49.tar.gz |
SERVER-49340 Add repair mode to validate for startup --repair
Diffstat (limited to 'src/mongo/db/repair_database.cpp')
-rw-r--r-- | src/mongo/db/repair_database.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp index 789eed1dc90..171f1efd2ad 100644 --- a/src/mongo/db/repair_database.cpp +++ b/src/mongo/db/repair_database.cpp @@ -168,6 +168,7 @@ Status repairCollections(OperationContext* opCtx, opCtx, nss, CollectionValidation::ValidateMode::kForegroundFullIndexOnly, + CollectionValidation::RepairMode::kRepair, &validateResults, &output); if (!status.isOK()) { @@ -176,6 +177,17 @@ Status repairCollections(OperationContext* opCtx, LOGV2(21028, "Collection validation", "results"_attr = output.done()); + if (validateResults.repaired) { + if (validateResults.valid) { + LOGV2(4934000, "Validate successfully repaired all data", "collection"_attr = nss); + } else { + LOGV2(4934001, "Validate was unable to repair all data", "collection"_attr = nss); + } + } else { + LOGV2(4934002, "Validate did not make any repairs", "collection"_attr = nss); + } + + // If not valid, whether repair ran or not, indexes will need to be rebuilt. if (!validateResults.valid) { status = rebuildIndexesForNamespace(opCtx, nss, engine); if (!status.isOK()) { |