summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp
diff options
context:
space:
mode:
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.cpp4
1 files changed, 4 insertions, 0 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 fdd0c12131c..0797b59f3bd 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
@@ -32,6 +32,7 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands.h"
#include "mongo/db/s/refine_collection_shard_key_coordinator.h"
+#include "mongo/db/s/sharding_state.h"
#include "mongo/s/request_types/refine_collection_shard_key_gen.h"
#include "mongo/s/request_types/sharded_ddl_commands_gen.h"
@@ -62,6 +63,9 @@ public:
using InvocationBase::InvocationBase;
void typedRun(OperationContext* opCtx) {
+ uassertStatusOK(ShardingState::get(opCtx)->canAcceptShardedCommands());
+ opCtx->setAlwaysInterruptAtStepDownOrUp();
+
auto coordinatorDoc = RefineCollectionShardKeyCoordinatorDocument();
coordinatorDoc.setShardingDDLCoordinatorMetadata(
{{ns(), DDLCoordinatorTypeEnum::kRefineCollectionShardKey}});