diff options
author | Eric Milkie <milkie@mongodb.com> | 2020-01-06 21:03:09 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-06 21:03:09 +0000 |
commit | 12d44ec1d9a03ed3d0828096bb32de925235c447 (patch) | |
tree | ec1a26abad1e82be3ffb59354f5ef0e450e70fc8 /src/mongo/db/repair_database.cpp | |
parent | 29c8868b7c1c79ca49341ee68d9e517a5c88f38f (diff) | |
download | mongo-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.cpp | 9 |
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; |