summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2022-03-21 17:17:01 +0000
committerTommaso Tocci <tommaso.tocci@mongodb.com>2022-03-23 15:37:56 +0100
commit5c12495a4e7dbf803ba0dc5064dd3c5b1491f170 (patch)
tree76b3da53351ac6f9a83555a42abd5cbdbab71392 /src
parent8e792015718d10e529fcb8d95089e9df2b8c034a (diff)
downloadmongo-5c12495a4e7dbf803ba0dc5064dd3c5b1491f170.tar.gz
SERVER-64651 Prevent refineCollectionShardKey to run on config server
(cherry picked from commit ece9ffb3227b8e69d8908ae0d0437701d9847a77)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/shardsvr_refine_collection_shard_key_command.cpp5
1 files changed, 5 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 49e3006d250..ed3f7c0b0ad 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
@@ -33,6 +33,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/commands/feature_compatibility_version.h"
#include "mongo/db/s/refine_collection_shard_key_coordinator.h"
+#include "mongo/db/s/sharding_state.h"
#include "mongo/s/refine_collection_shard_key_coordinator_feature_flags_gen.h"
#include "mongo/s/request_types/refine_collection_shard_key_gen.h"
#include "mongo/s/request_types/sharded_ddl_commands_gen.h"
@@ -64,6 +65,10 @@ public:
using InvocationBase::InvocationBase;
void typedRun(OperationContext* opCtx) {
+
+ uassertStatusOK(ShardingState::get(opCtx)->canAcceptShardedCommands());
+ opCtx->setAlwaysInterruptAtStepDownOrUp();
+
const auto coordinatorCompletionFuture = [&]() -> SharedSemiFuture<void> {
FixedFCVRegion fixedFcvRegion(opCtx);
const auto coordinatorType =