summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos José Grillo Ramirez <marcos.grillo@mongodb.com>2022-01-19 18:28:49 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-19 18:40:10 +0000
commitd4547038eb2e8f3620162d3e1730cd8cbec654b2 (patch)
treeb15eb8fa23aad15b702c1d0d35823709d73d3c57
parent826d0f22fb0d65b4c25ee4b50e362299670d2c80 (diff)
downloadmongo-d4547038eb2e8f3620162d3e1730cd8cbec654b2.tar.gz
SERVER-61837 Add majority write concern wait after index creation in chunk migration recipients on FCV 4.2
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index 7657072300e..f180717d223 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -1051,6 +1051,19 @@ void MigrationDestinationManager::_migrateDriver(OperationContext* outerOpCtx) {
auto opCtx = newOpCtxPtr.get();
cloneCollectionIndexesAndOptions(opCtx, _nss, donorCollectionOptionsAndIndexes);
+ // We need to ensure the index is created and majority committed regardless of fcv version.
+ if (!_useFCV44RangeDeleterProtocol) {
+ runWithoutSession(
+ outerOpCtx,
+ [&] {
+ WriteConcernResult ignoreResult;
+ auto latestOpTime =
+ repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp();
+ uassertStatusOK(waitForWriteConcern(
+ opCtx, latestOpTime, WriteConcerns::kMajorityWriteConcern, &ignoreResult));
+ },
+ _useFCV44RangeDeleterProtocol);
+ }
timing.done(2);
migrateThreadHangAtStep2.pauseWhileSet();
}