summaryrefslogtreecommitdiff
path: root/src/mongo/db/repair_database.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@mongodb.com>2020-01-06 21:03:09 +0000
committerevergreen <evergreen@mongodb.com>2020-01-06 21:03:09 +0000
commit12d44ec1d9a03ed3d0828096bb32de925235c447 (patch)
treeec1a26abad1e82be3ffb59354f5ef0e450e70fc8 /src/mongo/db/repair_database.cpp
parent29c8868b7c1c79ca49341ee68d9e517a5c88f38f (diff)
downloadmongo-12d44ec1d9a03ed3d0828096bb32de925235c447.tar.gz
SERVER-44904 startup recovery should not delete corrupt docs while rebuilding unfinished indexes
Diffstat (limited to 'src/mongo/db/repair_database.cpp')
-rw-r--r--src/mongo/db/repair_database.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp
index 533e0df0c6d..47283e8719b 100644
--- a/src/mongo/db/repair_database.cpp
+++ b/src/mongo/db/repair_database.cpp
@@ -109,7 +109,8 @@ StatusWith<IndexNameObjs> getIndexNameObjs(OperationContext* opCtx,
Status rebuildIndexesOnCollection(OperationContext* opCtx,
Collection* collection,
- const std::vector<BSONObj>& indexSpecs) {
+ const std::vector<BSONObj>& indexSpecs,
+ RepairData repair) {
// Skip the rest if there are no indexes to rebuild.
if (indexSpecs.empty())
return Status::OK();
@@ -117,8 +118,8 @@ Status rebuildIndexesOnCollection(OperationContext* opCtx,
// Rebuild the indexes provided by 'indexSpecs'.
IndexBuildsCoordinator* indexBuildsCoord = IndexBuildsCoordinator::get(opCtx);
UUID buildUUID = UUID::gen();
- auto swRebuild =
- indexBuildsCoord->rebuildIndexesForRecovery(opCtx, collection->ns(), indexSpecs, buildUUID);
+ auto swRebuild = indexBuildsCoord->rebuildIndexesForRecovery(
+ opCtx, collection->ns(), indexSpecs, buildUUID, repair);
if (!swRebuild.isOK()) {
return swRebuild.getStatus();
}
@@ -161,7 +162,7 @@ Status repairCollections(OperationContext* opCtx,
return swIndexNameObjs.getStatus();
std::vector<BSONObj> indexSpecs = swIndexNameObjs.getValue().second;
- Status status = rebuildIndexesOnCollection(opCtx, collection, indexSpecs);
+ Status status = rebuildIndexesOnCollection(opCtx, collection, indexSpecs, RepairData::kYes);
if (!status.isOK())
return status;