diff options
Diffstat (limited to 'src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp')
-rw-r--r-- | src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp b/src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp index f67a70f8312..e3e4d41d6a3 100644 --- a/src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp +++ b/src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp @@ -61,9 +61,16 @@ public: using InvocationBase::InvocationBase; void typedRun(OperationContext* opCtx) { - auto refineCoordinator = std::make_shared<RefineCollectionShardKeyCoordinator>( - opCtx, ns(), request().getNewShardKey()); - refineCoordinator->run(opCtx).get(opCtx); + auto coordinatorDoc = RefineCollectionShardKeyCoordinatorDocument(); + coordinatorDoc.setShardingDDLCoordinatorMetadata( + {{ns(), DDLCoordinatorTypeEnum::kRefineCollectionShardKey}}); + coordinatorDoc.setRefineCollectionShardKeyRequest( + request().getRefineCollectionShardKeyRequest()); + + auto service = ShardingDDLCoordinatorService::getService(opCtx); + auto refineCoordinator = checked_pointer_cast<RefineCollectionShardKeyCoordinator>( + service->getOrCreateInstance(opCtx, coordinatorDoc.toBSON())); + refineCoordinator->getCompletionFuture().get(opCtx); } bool supportsWriteConcern() const override { |