summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/core/views/views_all_commands.js2
-rw-r--r--jstests/noPassthrough/catalog_shard.js10
-rw-r--r--jstests/replsets/all_commands_downgrading_to_upgraded.js1
-rw-r--r--jstests/replsets/db_reads_while_recovering_all_commands.js1
-rw-r--r--jstests/sharding/database_versioning_all_commands.js1
-rw-r--r--jstests/sharding/libs/last_lts_mongos_commands.js1
-rw-r--r--jstests/sharding/read_write_concern_defaults_application.js2
-rw-r--r--jstests/sharding/safe_secondary_reads_drop_recreate.js2
-rw-r--r--jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js2
-rw-r--r--jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js2
-rw-r--r--src/mongo/db/auth/action_type.idl1
-rw-r--r--src/mongo/db/s/SConscript1
-rw-r--r--src/mongo/db/s/config/configsvr_transition_to_dedicated_config_server_command.cpp124
-rw-r--r--src/mongo/s/SConscript1
-rw-r--r--src/mongo/s/commands/SConscript1
-rw-r--r--src/mongo/s/commands/cluster_transition_to_dedicated_config_server_cmd.cpp114
-rw-r--r--src/mongo/s/request_types/transition_to_catalog_shard.idl2
-rw-r--r--src/mongo/s/request_types/transition_to_dedicated_config_server.idl50
18 files changed, 312 insertions, 6 deletions
diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js
index 896621b1658..1d0918c30f1 100644
--- a/jstests/core/views/views_all_commands.js
+++ b/jstests/core/views/views_all_commands.js
@@ -127,6 +127,7 @@ let viewsCommandTests = {
_configsvrSetClusterParameter: {skip: isAnInternalCommand},
_configsvrSetUserWriteBlockMode: {skip: isAnInternalCommand},
_configsvrTransitionToCatalogShard: {skip: isAnInternalCommand},
+ _configsvrTransitionToDedicatedConfigServer: {skip: isAnInternalCommand},
_configsvrUpdateZoneKeyRange: {skip: isAnInternalCommand},
_flushDatabaseCacheUpdates: {skip: isUnrelated},
_flushDatabaseCacheUpdatesWithWriteConcern: {skip: isUnrelated},
@@ -711,6 +712,7 @@ let viewsCommandTests = {
testVersions1And2: {skip: isAnInternalCommand},
top: {skip: "tested in views/views_stats.js"},
transitionToCatalogShard: {skip: isUnrelated},
+ transitionToDedicatedConfigServer: {skip: isUnrelated},
update: {command: {update: "view", updates: [{q: {x: 1}, u: {x: 2}}]}, expectFailure: true},
updateRole: {
command: {
diff --git a/jstests/noPassthrough/catalog_shard.js b/jstests/noPassthrough/catalog_shard.js
index 278cb9a7827..b3272a0149c 100644
--- a/jstests/noPassthrough/catalog_shard.js
+++ b/jstests/noPassthrough/catalog_shard.js
@@ -11,7 +11,6 @@
load("jstests/libs/fail_point_util.js");
-const kCatalogShardId = "catalogShard";
const dbName = "foo";
const collName = "bar";
const ns = dbName + "." + collName;
@@ -146,11 +145,12 @@ const newShardName =
// Remove the catalog shard.
//
- let removeRes = assert.commandWorked(st.s0.adminCommand({removeShard: kCatalogShardId}));
+ let removeRes =
+ assert.commandWorked(st.s0.adminCommand({transitionToDedicatedConfigServer: 1}));
assert.eq("started", removeRes.state);
// The removal won't complete until all chunks and dbs are moved off the catalog shard.
- removeRes = assert.commandWorked(st.s0.adminCommand({removeShard: kCatalogShardId}));
+ removeRes = assert.commandWorked(st.s0.adminCommand({transitionToDedicatedConfigServer: 1}));
assert.eq("ongoing", removeRes.state);
assert.commandWorked(st.s.adminCommand({moveChunk: ns, find: {skey: -1}, to: newShardName}));
@@ -158,12 +158,12 @@ const newShardName =
st.s.adminCommand({moveChunk: "config.system.sessions", find: {_id: 0}, to: newShardName}));
// Still blocked until the db has been moved away.
- removeRes = assert.commandWorked(st.s0.adminCommand({removeShard: kCatalogShardId}));
+ removeRes = assert.commandWorked(st.s0.adminCommand({transitionToDedicatedConfigServer: 1}));
assert.eq("ongoing", removeRes.state);
assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: newShardName}));
- removeRes = assert.commandWorked(st.s0.adminCommand({removeShard: kCatalogShardId}));
+ removeRes = assert.commandWorked(st.s0.adminCommand({transitionToDedicatedConfigServer: 1}));
assert.eq("completed", removeRes.state);
// Basic CRUD and sharded DDL work.
diff --git a/jstests/replsets/all_commands_downgrading_to_upgraded.js b/jstests/replsets/all_commands_downgrading_to_upgraded.js
index 9b10539dc9f..9444a9e4958 100644
--- a/jstests/replsets/all_commands_downgrading_to_upgraded.js
+++ b/jstests/replsets/all_commands_downgrading_to_upgraded.js
@@ -79,6 +79,7 @@ const allCommands = {
_configsvrSetClusterParameter: {skip: isAnInternalCommand},
_configsvrSetUserWriteBlockMode: {skip: isAnInternalCommand},
_configsvrTransitionToCatalogShard: {skip: isAnInternalCommand},
+ _configsvrTransitionToDedicatedConfigServer: {skip: isAnInternalCommand},
_configsvrUpdateZoneKeyRange: {skip: isAnInternalCommand},
_flushDatabaseCacheUpdates: {skip: isAnInternalCommand},
_flushDatabaseCacheUpdatesWithWriteConcern: {skip: isAnInternalCommand},
diff --git a/jstests/replsets/db_reads_while_recovering_all_commands.js b/jstests/replsets/db_reads_while_recovering_all_commands.js
index 3b68d06751b..4dced35c29c 100644
--- a/jstests/replsets/db_reads_while_recovering_all_commands.js
+++ b/jstests/replsets/db_reads_while_recovering_all_commands.js
@@ -64,6 +64,7 @@ const allCommands = {
_configsvrSetClusterParameter: {skip: isPrimaryOnly},
_configsvrSetUserWriteBlockMode: {skip: isPrimaryOnly},
_configsvrTransitionToCatalogShard: {skip: isPrimaryOnly},
+ _configsvrTransitionToDedicatedConfigServer: {skip: isPrimaryOnly},
_configsvrUpdateZoneKeyRange: {skip: isPrimaryOnly},
_flushDatabaseCacheUpdates: {skip: isPrimaryOnly},
_flushDatabaseCacheUpdatesWithWriteConcern: {skip: isPrimaryOnly},
diff --git a/jstests/sharding/database_versioning_all_commands.js b/jstests/sharding/database_versioning_all_commands.js
index af87c6cec68..3dd7b0c371f 100644
--- a/jstests/sharding/database_versioning_all_commands.js
+++ b/jstests/sharding/database_versioning_all_commands.js
@@ -709,6 +709,7 @@ let testCases = {
testVersion2: {skip: "executes locally on mongos (not sent to any remote node)"},
testVersions1And2: {skip: "executes locally on mongos (not sent to any remote node)"},
transitionToCatalogShard: {skip: "not on a user database"},
+ transitionToDedicatedConfigServer: {skip: "not on a user database"},
update: {
run: {
sendsDbVersion: true,
diff --git a/jstests/sharding/libs/last_lts_mongos_commands.js b/jstests/sharding/libs/last_lts_mongos_commands.js
index 986e7970f7f..2a24ddddf3a 100644
--- a/jstests/sharding/libs/last_lts_mongos_commands.js
+++ b/jstests/sharding/libs/last_lts_mongos_commands.js
@@ -49,5 +49,6 @@ const commandsAddedToMongosSinceLastLTS = [
"testVersions1And2",
"testVersion2",
"transitionToCatalogShard",
+ "transitionToDedicatedConfigServer",
"updateSearchIndex",
];
diff --git a/jstests/sharding/read_write_concern_defaults_application.js b/jstests/sharding/read_write_concern_defaults_application.js
index 46a11a18325..823db969b83 100644
--- a/jstests/sharding/read_write_concern_defaults_application.js
+++ b/jstests/sharding/read_write_concern_defaults_application.js
@@ -119,6 +119,7 @@ let testCases = {
_configsvrSetClusterParameter: {skip: "internal command"},
_configsvrSetUserWriteBlockMode: {skip: "internal command"},
_configsvrTransitionToCatalogShard: {skip: "internal command"},
+ _configsvrTransitionToDedicatedConfigServer: {skip: "internal command"},
_configsvrUpdateZoneKeyRange: {skip: "internal command"},
_flushDatabaseCacheUpdates: {skip: "internal command"},
_flushDatabaseCacheUpdatesWithWriteConcern: {skip: "internal command"},
@@ -737,6 +738,7 @@ let testCases = {
testVersion2: {skip: "does not accept read or write concern"},
top: {skip: "does not accept read or write concern"},
transitionToCatalogShard: {skip: "does not accept read or write concern"},
+ transitionToDedicatedConfigServer: {skip: "does not accept read or write concern"},
update: {
setUp: function(conn) {
assert.commandWorked(conn.getCollection(nss).insert({x: 1}, {writeConcern: {w: 1}}));
diff --git a/jstests/sharding/safe_secondary_reads_drop_recreate.js b/jstests/sharding/safe_secondary_reads_drop_recreate.js
index 1fe991f4d09..d4ccc36273b 100644
--- a/jstests/sharding/safe_secondary_reads_drop_recreate.js
+++ b/jstests/sharding/safe_secondary_reads_drop_recreate.js
@@ -64,6 +64,7 @@ let testCases = {
_configsvrRemoveShardFromZone: {skip: "primary only"},
_configsvrReshardCollection: {skip: "primary only"},
_configsvrTransitionToCatalogShard: {skip: "primary only"},
+ _configsvrTransitionToDedicatedConfigServer: {skip: "primary only"},
_configsvrUpdateZoneKeyRange: {skip: "primary only"},
_flushReshardingStateChange: {skip: "does not return user data"},
_flushRoutingTableCacheUpdates: {skip: "does not return user data"},
@@ -358,6 +359,7 @@ let testCases = {
testVersion2: {skip: "does not return user data"},
top: {skip: "does not return user data"},
transitionToCatalogShard: {skip: "primary only"},
+ transitionToDedicatedConfigServer: {skip: "primary only"},
update: {skip: "primary only"},
updateRole: {skip: "primary only"},
updateSearchIndex: {skip: "primary only"},
diff --git a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js
index 4510667f7cd..987237579bd 100644
--- a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js
+++ b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js
@@ -74,6 +74,7 @@ let testCases = {
_configsvrSetClusterParameter: {skip: "primary only"},
_configsvrSetUserWriteBlockMode: {skip: "primary only"},
_configsvrTransitionToCatalogShard: {skip: "primary only"},
+ _configsvrTransitionToDedicatedConfigServer: {skip: "primary only"},
_configsvrUpdateZoneKeyRange: {skip: "primary only"},
_flushReshardingStateChange: {skip: "does not return user data"},
_flushRoutingTableCacheUpdates: {skip: "does not return user data"},
@@ -429,6 +430,7 @@ let testCases = {
testVersion2: {skip: "does not return user data"},
top: {skip: "does not return user data"},
transitionToCatalogShard: {skip: "primary only"},
+ transitionToDedicatedConfigServer: {skip: "primary only"},
update: {skip: "primary only"},
updateRole: {skip: "primary only"},
updateSearchIndex: {skip: "does not return user data"},
diff --git a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js
index b3d2c1d4c50..70290373a5c 100644
--- a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js
+++ b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js
@@ -66,6 +66,7 @@ let testCases = {
_configsvrSetClusterParameter: {skip: "primary only"},
_configsvrSetUserWriteBlockMode: {skip: "primary only"},
_configsvrTransitionToCatalogShard: {skip: "primary only"},
+ _configsvrTransitionToDedicatedConfigServer: {skip: "primary only"},
_configsvrUpdateZoneKeyRange: {skip: "primary only"},
_flushReshardingStateChange: {skip: "does not return user data"},
_flushRoutingTableCacheUpdates: {skip: "does not return user data"},
@@ -364,6 +365,7 @@ let testCases = {
testVersions1And2: {skip: "does not return user data"},
testVersion2: {skip: "does not return user data"},
transitionToCatalogShard: {skip: "primary only"},
+ transitionToDedicatedConfigServer: {skip: "primary only"},
top: {skip: "does not return user data"},
update: {skip: "primary only"},
updateRole: {skip: "primary only"},
diff --git a/src/mongo/db/auth/action_type.idl b/src/mongo/db/auth/action_type.idl
index 1181eba7cc6..bf50504c00d 100644
--- a/src/mongo/db/auth/action_type.idl
+++ b/src/mongo/db/auth/action_type.idl
@@ -186,6 +186,7 @@ enums:
touch : "touch"
trafficRecord : "trafficRecord"
transitionToCatalogShard : "transitionToCatalogShard"
+ transitionToDedicatedConfigServer : "transitionToDedicatedConfigServer"
unlock : "unlock"
useTenant : "useTenant"
useUUID : "useUUID"
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index d1a8d0ec61f..fcfc2a33d39 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -462,6 +462,7 @@ env.Library(
'config/configsvr_set_user_write_block_mode_command.cpp',
'config/configsvr_split_chunk_command.cpp',
'config/configsvr_transition_to_catalog_shard_command.cpp',
+ 'config/configsvr_transition_to_dedicated_config_server_command.cpp',
'config/configsvr_update_zone_key_range_command.cpp',
'config/set_cluster_parameter_coordinator_document.idl',
'config/set_cluster_parameter_coordinator.cpp',
diff --git a/src/mongo/db/s/config/configsvr_transition_to_dedicated_config_server_command.cpp b/src/mongo/db/s/config/configsvr_transition_to_dedicated_config_server_command.cpp
new file mode 100644
index 00000000000..963a0dbfac9
--- /dev/null
+++ b/src/mongo/db/s/config/configsvr_transition_to_dedicated_config_server_command.cpp
@@ -0,0 +1,124 @@
+/**
+ * Copyright (C) 2023-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/auth/action_type.h"
+#include "mongo/db/auth/authorization_session.h"
+#include "mongo/db/catalog_shard_feature_flag_gen.h"
+#include "mongo/db/client.h"
+#include "mongo/db/commands.h"
+#include "mongo/db/dbdirectclient.h"
+#include "mongo/db/operation_context.h"
+#include "mongo/db/s/sharding_state.h"
+#include "mongo/logv2/log.h"
+
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
+
+namespace mongo {
+namespace {
+
+/**
+ * Internal sharding command run on config servers for transitioning from catalog shard to
+ * dedicated config server.
+ */
+class ConfigSvrTransitionToDedicatedConfigCommand : public BasicCommand {
+public:
+ ConfigSvrTransitionToDedicatedConfigCommand()
+ : BasicCommand("_configsvrTransitionToDedicatedConfigServer") {}
+
+ bool skipApiVersionCheck() const override {
+ // Internal command (server to server).
+ return true;
+ }
+
+ std::string help() const override {
+ return "Internal command, which is exported by the sharding config server. Do not call "
+ "directly. Transitions a cluster to use dedicated config server.";
+ }
+
+ AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
+ return AllowedOnSecondary::kNever;
+ }
+
+ bool adminOnly() const override {
+ return true;
+ }
+
+ bool supportsWriteConcern(const BSONObj& cmd) const override {
+ return true;
+ }
+
+ Status checkAuthForOperation(OperationContext* opCtx,
+ const DatabaseName&,
+ const BSONObj&) const override {
+ if (!AuthorizationSession::get(opCtx->getClient())
+ ->isAuthorizedForActionsOnResource(
+ ResourcePattern::forClusterResource(),
+ ActionType::transitionToDedicatedConfigServer)) {
+ return Status(ErrorCodes::Unauthorized, "Unauthorized");
+ }
+ return Status::OK();
+ }
+
+ bool run(OperationContext* opCtx,
+ const DatabaseName&,
+ const BSONObj& cmdObj,
+ BSONObjBuilder& result) override {
+ uassert(7368402,
+ "catalog shard feature is disabled",
+ gFeatureFlagCatalogShard.isEnabled(serverGlobalParams.featureCompatibility));
+
+ uassert(ErrorCodes::IllegalOperation,
+ "_configsvrTransitionToDedicatedConfigServer can only be run on config servers",
+ serverGlobalParams.clusterRole == ClusterRole::ConfigServer);
+ CommandHelpers::uassertCommandRunWithMajority(getName(), opCtx->getWriteConcern());
+
+ auto shardingState = ShardingState::get(opCtx);
+ uassertStatusOK(shardingState->canAcceptShardedCommands());
+ const std::string shardName = shardingState->shardId().toString();
+
+ DBDirectClient client(opCtx);
+ BSONObj response;
+
+ // Need to append w: majority because removeShard commands requires it.
+ auto removeShardCmd = CommandHelpers::appendMajorityWriteConcern(
+ BSON("_configsvrRemoveShard" << shardName), opCtx->getWriteConcern());
+ client.runCommand(DatabaseName{"admin"}, removeShardCmd, response);
+
+ uassertStatusOK(getStatusFromCommandResult(response));
+ uassertStatusOK(getWriteConcernStatusFromCommandResult(response));
+
+ CommandHelpers::filterCommandReplyForPassthrough(response, &result);
+
+ return true;
+ }
+
+} configSvrTransitionToDedicatedConfigCmd;
+
+} // namespace
+} // namespace mongo
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index fc44f37927a..db5eccbab0a 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -254,6 +254,7 @@ env.Library(
'request_types/sharded_ddl_commands.idl',
'request_types/shardsvr_join_migrations_request.idl',
'request_types/transition_to_catalog_shard.idl',
+ 'request_types/transition_to_dedicated_config_server.idl',
'request_types/update_zone_key_range_request_type.cpp',
'request_types/wait_for_fail_point.idl',
'resharding/common_types.idl',
diff --git a/src/mongo/s/commands/SConscript b/src/mongo/s/commands/SConscript
index 49c2456748b..f6c5813816c 100644
--- a/src/mongo/s/commands/SConscript
+++ b/src/mongo/s/commands/SConscript
@@ -97,6 +97,7 @@ env.Library(
'cluster_shard_collection_cmd.cpp',
'cluster_shutdown_cmd.cpp',
'cluster_transition_to_catalog_shard_cmd.cpp',
+ 'cluster_transition_to_dedicated_config_server_cmd.cpp',
'cluster_validate_cmd.cpp',
'cluster_validate_db_metadata_cmd.cpp',
'cluster_whats_my_uri_cmd.cpp',
diff --git a/src/mongo/s/commands/cluster_transition_to_dedicated_config_server_cmd.cpp b/src/mongo/s/commands/cluster_transition_to_dedicated_config_server_cmd.cpp
new file mode 100644
index 00000000000..b1a4a73e223
--- /dev/null
+++ b/src/mongo/s/commands/cluster_transition_to_dedicated_config_server_cmd.cpp
@@ -0,0 +1,114 @@
+/**
+ * Copyright (C) 2023-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/auth/authorization_session.h"
+#include "mongo/db/catalog_shard_feature_flag_gen.h"
+#include "mongo/db/commands.h"
+#include "mongo/s/client/shard_registry.h"
+#include "mongo/s/grid.h"
+#include "mongo/s/request_types/transition_to_dedicated_config_server_gen.h"
+
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
+
+namespace mongo {
+namespace {
+
+const ReadPreferenceSetting kPrimaryOnlyReadPreference{ReadPreference::PrimaryOnly};
+
+class TransitionToDedicatedConfigServerCmd : public BasicCommand {
+public:
+ TransitionToDedicatedConfigServerCmd() : BasicCommand("transitionToDedicatedConfigServer") {}
+
+ AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
+ return AllowedOnSecondary::kNever;
+ }
+
+ bool adminOnly() const override {
+ return true;
+ }
+
+ bool supportsWriteConcern(const BSONObj& cmd) const override {
+ return true;
+ }
+
+ std::string help() const override {
+ return "transition to dedicated config server";
+ }
+
+ Status checkAuthForOperation(OperationContext* opCtx,
+ const DatabaseName&,
+ const BSONObj&) const override {
+ auto* as = AuthorizationSession::get(opCtx->getClient());
+ if (!as->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
+ ActionType::transitionToDedicatedConfigServer)) {
+ return {ErrorCodes::Unauthorized, "unauthorized"};
+ }
+
+ return Status::OK();
+ }
+
+ bool run(OperationContext* opCtx,
+ const DatabaseName&,
+ const BSONObj& cmdObj,
+ BSONObjBuilder& result) override {
+ uassert(7368401,
+ "catalog shard feature is disabled",
+ gFeatureFlagCatalogShard.isEnabled(serverGlobalParams.featureCompatibility));
+
+ auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
+
+ ConfigsvrTransitionToDedicatedConfig transitionToDedicatedConfigServer;
+ transitionToDedicatedConfigServer.setDbName({"admin"});
+
+ // Force a reload of this node's shard list cache at the end of this command.
+ auto cmdResponseWithStatus = configShard->runCommandWithFixedRetryAttempts(
+ opCtx,
+ kPrimaryOnlyReadPreference,
+ "admin",
+ CommandHelpers::appendMajorityWriteConcern(
+ CommandHelpers::appendGenericCommandArgs(
+ cmdObj, transitionToDedicatedConfigServer.toBSON({})),
+ opCtx->getWriteConcern()),
+ Shard::RetryPolicy::kIdempotent);
+
+ Grid::get(opCtx)->shardRegistry()->reload(opCtx);
+
+ uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(cmdResponseWithStatus));
+ CommandHelpers::filterCommandReplyForPassthrough(cmdResponseWithStatus.getValue().response,
+ &result);
+
+ return true;
+ }
+
+} transitionToDedicatedConfigServerCmd;
+
+} // namespace
+} // namespace mongo
diff --git a/src/mongo/s/request_types/transition_to_catalog_shard.idl b/src/mongo/s/request_types/transition_to_catalog_shard.idl
index 738ff7c3b1b..e2f4258816e 100644
--- a/src/mongo/s/request_types/transition_to_catalog_shard.idl
+++ b/src/mongo/s/request_types/transition_to_catalog_shard.idl
@@ -46,6 +46,6 @@ commands:
description: "The transitionToCatalogShard command for config server."
command_name: _configsvrTransitionToCatalogShard
cpp_name: ConfigsvrTransitionToCatalogShard
- strict: true
+ strict: false
namespace: ignored
api_version: ""
diff --git a/src/mongo/s/request_types/transition_to_dedicated_config_server.idl b/src/mongo/s/request_types/transition_to_dedicated_config_server.idl
new file mode 100644
index 00000000000..0d61eb29c3b
--- /dev/null
+++ b/src/mongo/s/request_types/transition_to_dedicated_config_server.idl
@@ -0,0 +1,50 @@
+# Copyright (C) 2023-present MongoDB, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the Server Side Public License, version 1,
+# as published by MongoDB, Inc.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# Server Side Public License for more details.
+#
+# You should have received a copy of the Server Side Public License
+# along with this program. If not, see
+# <http://www.mongodb.com/licensing/server-side-public-license>.
+#
+# As a special exception, the copyright holders give permission to link the
+# code of portions of this program with the OpenSSL library under certain
+# conditions as described in each individual source file and distribute
+# linked combinations including the program with the OpenSSL library. You
+# must comply with the Server Side Public License in all respects for
+# all of the code used other than as permitted herein. If you modify file(s)
+# with this exception, you may extend this exception to your version of the
+# file(s), but you are not obligated to do so. If you do not wish to do so,
+# delete this exception statement from your version. If you delete this
+# exception statement from all source files in the program, then also delete
+# it in the license file.
+#
+
+global:
+ cpp_namespace: "mongo"
+
+imports:
+ - "mongo/db/basic_types.idl"
+
+commands:
+ transitionToDedicatedConfigServer:
+ command_name: transitionToDedicatedConfigServer
+ cpp_name: TransitionToDedicatedConfigServer
+ strict: true
+ description: "mongos command for transitioning to dedicated config server"
+ namespace: ignored
+ api_version: ""
+
+ _configsvrTransitionToDedicatedConfigServer:
+ command_name: _configsvrTransitionToDedicatedConfigServer
+ cpp_name: ConfigsvrTransitionToDedicatedConfig
+ strict: false
+ description: "mongos command for transitioning to dedicated config server"
+ namespace: ignored
+ api_version: ""