summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/create_collection_coordinator.cpp
diff options
context:
space:
mode:
authorJordi Serra Torrens <jordi.serra-torrens@mongodb.com>2021-12-15 14:37:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-15 15:19:33 +0000
commit703fb345ce17aa27392230bdd7f09f29d0c526da (patch)
tree2e8ab2b0a58f32eaadbce4376b7cf9bafeb663bd /src/mongo/db/s/create_collection_coordinator.cpp
parentc67b5eb3b1c009f8ed794daae6b01539ca7a23b2 (diff)
downloadmongo-703fb345ce17aa27392230bdd7f09f29d0c526da.tar.gz
SERVER-58275 Deduplicate code to make a noop write to participants in ShardingDDLCoordinators
Diffstat (limited to 'src/mongo/db/s/create_collection_coordinator.cpp')
-rw-r--r--src/mongo/db/s/create_collection_coordinator.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp
index 532f5d080c0..ad201f5caf4 100644
--- a/src/mongo/db/s/create_collection_coordinator.cpp
+++ b/src/mongo/db/s/create_collection_coordinator.cpp
@@ -447,7 +447,9 @@ ExecutorFuture<void> CreateCollectionCoordinator::_runImpl(
// Perform a noop write on the participants in order to advance the txnNumber
// for this coordinator's lsid so that requests with older txnNumbers can no
// longer execute.
- _performNoopRetryableWriteOnParticipants(opCtx, **executor);
+ _doc = _updateSession(opCtx, _doc);
+ _performNoopRetryableWriteOnAllShardsAndConfigsvr(
+ opCtx, getCurrentSession(_doc), **executor);
}
if (_recoveredFromDisk) {
@@ -940,20 +942,6 @@ void CreateCollectionCoordinator::_logEndCreateCollection(OperationContext* opCt
opCtx, "shardCollection.end", nss().ns(), collectionDetail.obj());
}
-void CreateCollectionCoordinator::_performNoopRetryableWriteOnParticipants(
- OperationContext* opCtx, const std::shared_ptr<executor::TaskExecutor>& executor) {
- auto shardsAndConfigsvr = [&] {
- const auto shardRegistry = Grid::get(opCtx)->shardRegistry();
- auto participants = shardRegistry->getAllShardIds(opCtx);
- participants.emplace_back(shardRegistry->getConfigShard()->getId());
- return participants;
- }();
-
- _doc = _updateSession(opCtx, _doc);
- sharding_ddl_util::performNoopRetryableWriteOnShards(
- opCtx, shardsAndConfigsvr, getCurrentSession(_doc), executor);
-}
-
// Phase change API.
void CreateCollectionCoordinator::_enterPhase(Phase newPhase) {