diff options
author | Adi Zaimi <adizaimi@yahoo.com> | 2021-09-09 14:21:14 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-09 15:06:38 +0000 |
commit | 1181ad492b061a582c7873c8ee610b098c9076b8 (patch) | |
tree | b01c919af1c2dc437ef473feba9e811d8bf8b070 /src/mongo/db | |
parent | e1517972ad00351a79030fce12a62d9cee5f8cce (diff) | |
download | mongo-1181ad492b061a582c7873c8ee610b098c9076b8.tar.gz |
SERVER-58893 more commands to skip api version check
Diffstat (limited to 'src/mongo/db')
53 files changed, 286 insertions, 19 deletions
diff --git a/src/mongo/db/commands/cpuload.cpp b/src/mongo/db/commands/cpuload.cpp index e9e5531f8f0..23279a4b688 100644 --- a/src/mongo/db/commands/cpuload.cpp +++ b/src/mongo/db/commands/cpuload.cpp @@ -48,6 +48,10 @@ public: virtual bool isWriteCommandForConfigServer() const { return false; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } std::string help() const override { return "internal. for testing only." "{ cpuload : 1, cpuFactor : 1 } Runs a straight CPU load. Length of execution " diff --git a/src/mongo/db/commands/internal_rename_if_options_and_indexes_match_cmd.cpp b/src/mongo/db/commands/internal_rename_if_options_and_indexes_match_cmd.cpp index f9384853ac4..2bce9d0d65f 100644 --- a/src/mongo/db/commands/internal_rename_if_options_and_indexes_match_cmd.cpp +++ b/src/mongo/db/commands/internal_rename_if_options_and_indexes_match_cmd.cpp @@ -111,6 +111,11 @@ public: } }; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command to rename and check collection options"; } diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp index c2b5e716523..3669190782d 100644 --- a/src/mongo/db/commands/isself.cpp +++ b/src/mongo/db/commands/isself.cpp @@ -47,6 +47,10 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } std::string help() const override { return "{ _isSelf : 1 } INTERNAL ONLY"; } diff --git a/src/mongo/db/commands/killoperations_common.h b/src/mongo/db/commands/killoperations_common.h index 6d18fe8e5a7..b9dd9eb79a9 100644 --- a/src/mongo/db/commands/killoperations_common.h +++ b/src/mongo/db/commands/killoperations_common.h @@ -108,6 +108,11 @@ private: return true; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command -- Kill operations on the target server by OperationKey."; } diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index 5990af74f85..e5a43d3a7bc 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -918,6 +918,7 @@ struct UMCStdParams { static constexpr bool adminOnly = false; static constexpr bool supportsWriteConcern = true; static constexpr auto allowedOnSecondary = BasicCommand::AllowedOnSecondary::kNever; + static constexpr bool skipApiVersionCheck = false; }; // Used by {usersInfo:...} and {rolesInfo:...} @@ -925,15 +926,26 @@ struct UMCInfoParams { static constexpr bool adminOnly = false; static constexpr bool supportsWriteConcern = false; static constexpr auto allowedOnSecondary = BasicCommand::AllowedOnSecondary::kOptIn; + static constexpr bool skipApiVersionCheck = false; }; -// Used by {invalidateUserCache:...} and {_getUserCacheGeneration:...} -struct UMCCacheParams { +// Used by {invalidateUserCache:...} +struct UMCInvalidateUserCacheParams { + static constexpr bool adminOnly = false; + static constexpr bool supportsWriteConcern = false; + static constexpr auto allowedOnSecondary = BasicCommand::AllowedOnSecondary::kAlways; + static constexpr bool skipApiVersionCheck = false; +}; + +// Used by {_getUserCacheGeneration:...} +struct UMCGetUserCacheGenParams { static constexpr bool adminOnly = true; static constexpr bool supportsWriteConcern = false; static constexpr auto allowedOnSecondary = BasicCommand::AllowedOnSecondary::kAlways; + static constexpr bool skipApiVersionCheck = true; }; + template <typename RequestT, typename Params = UMCStdParams> class CmdUMCTyped : public TypedCommand<CmdUMCTyped<RequestT, Params>> { public: @@ -962,6 +974,10 @@ public: } }; + bool skipApiVersionCheck() const final { + return Params::skipApiVersionCheck; + } + bool adminOnly() const final { return Params::adminOnly; } @@ -971,6 +987,7 @@ public: } }; + class CmdCreateUser : public CmdUMCTyped<CreateUserCommand> { public: static constexpr StringData kPwdField = "pwd"_sd; @@ -2027,24 +2044,26 @@ RolesInfoReply CmdUMCTyped<RolesInfoCommand, UMCInfoParams>::Invocation::typedRu return reply; } -CmdUMCTyped<InvalidateUserCacheCommand, UMCCacheParams> cmdInvalidateUserCache; +CmdUMCTyped<InvalidateUserCacheCommand, UMCInvalidateUserCacheParams> cmdInvalidateUserCache; template <> -void CmdUMCTyped<InvalidateUserCacheCommand, UMCCacheParams>::Invocation::typedRun( +void CmdUMCTyped<InvalidateUserCacheCommand, UMCInvalidateUserCacheParams>::Invocation::typedRun( OperationContext* opCtx) { auto* authzManager = AuthorizationManager::get(opCtx->getServiceContext()); auto lk = requireReadableAuthSchema26Upgrade(opCtx, authzManager); authzManager->invalidateUserCache(opCtx); } -CmdUMCTyped<GetUserCacheGenerationCommand, UMCCacheParams> cmdGetUserCacheGeneration; +CmdUMCTyped<GetUserCacheGenerationCommand, UMCGetUserCacheGenParams> cmdGetUserCacheGeneration; + template <> GetUserCacheGenerationReply -CmdUMCTyped<GetUserCacheGenerationCommand, UMCCacheParams>::Invocation::typedRun( +CmdUMCTyped<GetUserCacheGenerationCommand, UMCGetUserCacheGenParams>::Invocation::typedRun( OperationContext* opCtx) { uassert(ErrorCodes::IllegalOperation, "_getUserCacheGeneration can only be run on config servers", serverGlobalParams.clusterRole == ClusterRole::ConfigServer); + cmdGetUserCacheGeneration.skipApiVersionCheck(); GetUserCacheGenerationReply reply; auto* authzManager = AuthorizationManager::get(opCtx->getServiceContext()); reply.setCacheGeneration(authzManager->getCacheGeneration()); diff --git a/src/mongo/db/s/add_shard_cmd.cpp b/src/mongo/db/s/add_shard_cmd.cpp index e75c8e85e37..3bfc1cc4a18 100644 --- a/src/mongo/db/s/add_shard_cmd.cpp +++ b/src/mongo/db/s/add_shard_cmd.cpp @@ -105,6 +105,11 @@ public: } }; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is exported by shards. Do not call " "directly. Adds a new shard to a cluster."; diff --git a/src/mongo/db/s/clone_catalog_data_command.cpp b/src/mongo/db/s/clone_catalog_data_command.cpp index a182aaeaa7f..f25b3740995 100644 --- a/src/mongo/db/s/clone_catalog_data_command.cpp +++ b/src/mongo/db/s/clone_catalog_data_command.cpp @@ -55,6 +55,11 @@ class CloneCatalogDataCommand : public BasicCommand { public: CloneCatalogDataCommand() : BasicCommand("_shardsvrCloneCatalogData", "_cloneCatalogData") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/clone_collection_options_from_primary_shard_cmd.cpp b/src/mongo/db/s/clone_collection_options_from_primary_shard_cmd.cpp index 1714facebef..bfcb509fb1b 100644 --- a/src/mongo/db/s/clone_collection_options_from_primary_shard_cmd.cpp +++ b/src/mongo/db/s/clone_collection_options_from_primary_shard_cmd.cpp @@ -84,6 +84,11 @@ public: } }; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, do not call directly. Creates a collection on a shard with UUID" " existing on primary."; diff --git a/src/mongo/db/s/config/configsvr_abort_reshard_collection_command.cpp b/src/mongo/db/s/config/configsvr_abort_reshard_collection_command.cpp index 8279c18a332..7a5653bb594 100644 --- a/src/mongo/db/s/config/configsvr_abort_reshard_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_abort_reshard_collection_command.cpp @@ -162,6 +162,11 @@ public: } }; + 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. Aborts any in-progress resharding operations for this collection."; diff --git a/src/mongo/db/s/config/configsvr_add_shard_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_command.cpp index bdfce562f53..7504b149e50 100644 --- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp +++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp @@ -59,6 +59,11 @@ class ConfigSvrAddShardCommand : public BasicCommand { public: ConfigSvrAddShardCommand() : BasicCommand("_configsvrAddShard") {} + 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. Validates and adds a new shard to the cluster."; diff --git a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp index 217511db4b7..ceeec797466 100644 --- a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp +++ b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp @@ -58,6 +58,11 @@ class ConfigSvrAddShardToZoneCommand : public BasicCommand { public: ConfigSvrAddShardToZoneCommand() : BasicCommand("_configsvrAddShardToZone") {} + 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. Validates and adds a new zone to the shard."; diff --git a/src/mongo/db/s/config/configsvr_balancer_collection_status_command.cpp b/src/mongo/db/s/config/configsvr_balancer_collection_status_command.cpp index f854737a4f3..40c4f38f1c2 100644 --- a/src/mongo/db/s/config/configsvr_balancer_collection_status_command.cpp +++ b/src/mongo/db/s/config/configsvr_balancer_collection_status_command.cpp @@ -102,6 +102,11 @@ public: } }; + 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. Checks whether the chunks of a given collection are in a quiesced state " diff --git a/src/mongo/db/s/config/configsvr_cleanup_reshard_collection_command.cpp b/src/mongo/db/s/config/configsvr_cleanup_reshard_collection_command.cpp index 9388c18ae4f..e8a256be75a 100644 --- a/src/mongo/db/s/config/configsvr_cleanup_reshard_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_cleanup_reshard_collection_command.cpp @@ -134,6 +134,11 @@ public: } }; + 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. Aborts and cleans up any in-progress resharding operations for this " diff --git a/src/mongo/db/s/config/configsvr_clear_jumbo_flag_command.cpp b/src/mongo/db/s/config/configsvr_clear_jumbo_flag_command.cpp index c25d4dc9bdf..9f4a3a07cc2 100644 --- a/src/mongo/db/s/config/configsvr_clear_jumbo_flag_command.cpp +++ b/src/mongo/db/s/config/configsvr_clear_jumbo_flag_command.cpp @@ -116,6 +116,11 @@ public: } }; + 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. Clears the jumbo flag of the chunk specified."; diff --git a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp index da5ba2bb5ce..be58bd4c9b6 100644 --- a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp +++ b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp @@ -81,6 +81,11 @@ class ConfigSvrCommitChunkMigrationCommand : public BasicCommand { public: ConfigSvrCommitChunkMigrationCommand() : BasicCommand("_configsvrCommitChunkMigration") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "should not be calling this directly"; } diff --git a/src/mongo/db/s/config/configsvr_commit_reshard_collection_command.cpp b/src/mongo/db/s/config/configsvr_commit_reshard_collection_command.cpp index aeb77f1f702..6cf6440a36f 100644 --- a/src/mongo/db/s/config/configsvr_commit_reshard_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_commit_reshard_collection_command.cpp @@ -115,6 +115,11 @@ public: } }; + 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. Allows a reshard operation to enter critical section ASAP."; diff --git a/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp b/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp index 921e2d52347..6286ae55baf 100644 --- a/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp +++ b/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp @@ -100,6 +100,11 @@ public: } }; + 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."; diff --git a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp index 10fa0aa6739..84d97e2ee58 100644 --- a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp +++ b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp @@ -48,6 +48,11 @@ class ConfigSvrBalancerControlCommand : public BasicCommand { public: ConfigSvrBalancerControlCommand(StringData name) : BasicCommand(name) {} + 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. Controls the balancer state."; diff --git a/src/mongo/db/s/config/configsvr_create_database_command.cpp b/src/mongo/db/s/config/configsvr_create_database_command.cpp index c3d332d3f4d..86d2c81607d 100644 --- a/src/mongo/db/s/config/configsvr_create_database_command.cpp +++ b/src/mongo/db/s/config/configsvr_create_database_command.cpp @@ -56,7 +56,7 @@ public: * command. */ bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } diff --git a/src/mongo/db/s/config/configsvr_ensure_chunk_version_is_greater_than_command.cpp b/src/mongo/db/s/config/configsvr_ensure_chunk_version_is_greater_than_command.cpp index a4c782094f1..1b39374f9da 100644 --- a/src/mongo/db/s/config/configsvr_ensure_chunk_version_is_greater_than_command.cpp +++ b/src/mongo/db/s/config/configsvr_ensure_chunk_version_is_greater_than_command.cpp @@ -82,6 +82,11 @@ public: } }; + 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."; diff --git a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp index 17e7fb7436c..d3566c9b750 100644 --- a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp +++ b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp @@ -66,6 +66,11 @@ class ConfigSvrMergeChunkCommand : public TypedCommand<ConfigSvrMergeChunkComman public: using Request = ConfigSvrMergeChunk; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is sent by a shard to the sharding config server. Do " "not call directly. Receives, validates, and processes a ConfigSvrMergeChunk"; diff --git a/src/mongo/db/s/config/configsvr_merge_chunks_command.cpp b/src/mongo/db/s/config/configsvr_merge_chunks_command.cpp index c41a366fe4b..c794f6714c4 100644 --- a/src/mongo/db/s/config/configsvr_merge_chunks_command.cpp +++ b/src/mongo/db/s/config/configsvr_merge_chunks_command.cpp @@ -52,6 +52,11 @@ class ConfigSvrMergeChunksCommand : public TypedCommand<ConfigSvrMergeChunksComm public: using Request = ConfigSvrMergeChunks; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is sent by a shard to the sharding config server. Do " "not call directly. Receives, validates, and processes a ConfigSvrMergeChunks"; diff --git a/src/mongo/db/s/config/configsvr_refine_collection_shard_key_command.cpp b/src/mongo/db/s/config/configsvr_refine_collection_shard_key_command.cpp index 67a8843e5e2..ef766dd1d68 100644 --- a/src/mongo/db/s/config/configsvr_refine_collection_shard_key_command.cpp +++ b/src/mongo/db/s/config/configsvr_refine_collection_shard_key_command.cpp @@ -158,6 +158,11 @@ public: } }; + 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. Adds a suffix to the shard key of an existing collection ('refines the " diff --git a/src/mongo/db/s/config/configsvr_remove_chunks_command.cpp b/src/mongo/db/s/config/configsvr_remove_chunks_command.cpp index e0b40d08a64..77289aa3100 100644 --- a/src/mongo/db/s/config/configsvr_remove_chunks_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_chunks_command.cpp @@ -131,6 +131,11 @@ public: } }; + 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. Removes the chunks for the specified collectionUUID."; diff --git a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp index 68d44a9435f..7476c4b9aba 100644 --- a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp @@ -59,6 +59,11 @@ class ConfigSvrRemoveShardCommand : public BasicCommand { public: ConfigSvrRemoveShardCommand() : BasicCommand("_configsvrRemoveShard") {} + 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. Removes a shard from the cluster."; diff --git a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp index b50512c2fe7..7c9dc06926e 100644 --- a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp @@ -61,6 +61,11 @@ class ConfigSvrRemoveShardFromZoneCommand : public BasicCommand { public: ConfigSvrRemoveShardFromZoneCommand() : BasicCommand("_configsvrRemoveShardFromZone") {} + 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. Validates and removes the shard from the zone."; diff --git a/src/mongo/db/s/config/configsvr_remove_tags_command.cpp b/src/mongo/db/s/config/configsvr_remove_tags_command.cpp index dbb884783fc..9bf9dbed174 100644 --- a/src/mongo/db/s/config/configsvr_remove_tags_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_tags_command.cpp @@ -126,6 +126,11 @@ public: } }; + 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. Removes the zone tags for the specified ns."; diff --git a/src/mongo/db/s/config/configsvr_rename_collection_metadata_command.cpp b/src/mongo/db/s/config/configsvr_rename_collection_metadata_command.cpp index edd1f97d08e..854f6e359e4 100644 --- a/src/mongo/db/s/config/configsvr_rename_collection_metadata_command.cpp +++ b/src/mongo/db/s/config/configsvr_rename_collection_metadata_command.cpp @@ -50,6 +50,11 @@ class ConfigsvrRenameCollectionMetadataCommand final public: using Request = ConfigsvrRenameCollectionMetadata; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Renames a collection."; } diff --git a/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp b/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp index 855e2a22636..49cc025db3d 100644 --- a/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp +++ b/src/mongo/db/s/config/configsvr_reshard_collection_cmd.cpp @@ -241,6 +241,11 @@ public: } }; + 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. Reshards a collection on a new shard key."; diff --git a/src/mongo/db/s/config/configsvr_set_allow_migrations_command.cpp b/src/mongo/db/s/config/configsvr_set_allow_migrations_command.cpp index f6c6d3277e9..f70df3d9d9f 100644 --- a/src/mongo/db/s/config/configsvr_set_allow_migrations_command.cpp +++ b/src/mongo/db/s/config/configsvr_set_allow_migrations_command.cpp @@ -90,6 +90,11 @@ public: } }; + 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. Sets the allowMigrations flag on the specified collection."; diff --git a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp index 0ba5b71f446..79d61b378d9 100644 --- a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp +++ b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp @@ -66,6 +66,11 @@ class ConfigSvrSplitChunkCommand : public BasicCommand { public: ConfigSvrSplitChunkCommand() : BasicCommand("_configsvrCommitChunkSplit") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is sent by a shard to the sharding config server. Do " "not call directly. Receives, validates, and processes a SplitChunkRequest."; diff --git a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp index 5e26c029889..665d52f1ff4 100644 --- a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp +++ b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp @@ -63,6 +63,11 @@ class ConfigsvrUpdateZoneKeyRangeCommand : public BasicCommand { public: ConfigsvrUpdateZoneKeyRangeCommand() : BasicCommand("_configsvrUpdateZoneKeyRange") {} + 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. Validates and assigns a new range to a zone."; diff --git a/src/mongo/db/s/flush_database_cache_updates_command.cpp b/src/mongo/db/s/flush_database_cache_updates_command.cpp index 1f5a5be294a..361bb6f1132 100644 --- a/src/mongo/db/s/flush_database_cache_updates_command.cpp +++ b/src/mongo/db/s/flush_database_cache_updates_command.cpp @@ -72,7 +72,7 @@ public: * command. */ bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } diff --git a/src/mongo/db/s/flush_resharding_state_change_command.cpp b/src/mongo/db/s/flush_resharding_state_change_command.cpp index b97dd33b5ea..c4615016823 100644 --- a/src/mongo/db/s/flush_resharding_state_change_command.cpp +++ b/src/mongo/db/s/flush_resharding_state_change_command.cpp @@ -78,6 +78,11 @@ class FlushReshardingStateChangeCmd final : public TypedCommand<FlushReshardingS public: using Request = _flushReshardingStateChange; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command used by the resharding coordinator to flush state changes to the " "participant shards while the critical section is active."; diff --git a/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp b/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp index d75b881e46c..4ebd39a9ae3 100644 --- a/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp +++ b/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp @@ -56,6 +56,11 @@ namespace { template <typename Derived> class FlushRoutingTableCacheUpdatesCmdBase : public TypedCommand<Derived> { public: + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command which waits for any pending routing table cache updates for a " "particular namespace to be written locally. The operationTime returned in the " diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp index 2f255b68fc2..7112be9b31c 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp @@ -130,6 +130,11 @@ class InitialCloneCommand : public BasicCommand { public: InitialCloneCommand() : BasicCommand("_migrateClone") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } @@ -192,6 +197,11 @@ class TransferModsCommand : public BasicCommand { public: TransferModsCommand() : BasicCommand("_transferMods") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } @@ -241,6 +251,11 @@ class MigrateSessionCommand : public BasicCommand { public: MigrateSessionCommand() : BasicCommand("_getNextSessionMods") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } diff --git a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp index 1f6ac6ad58e..2511db498ed 100644 --- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp +++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp @@ -57,6 +57,11 @@ class RecvChunkStartCommand : public ErrmsgCommandDeprecated { public: RecvChunkStartCommand() : ErrmsgCommandDeprecated("_recvChunkStart") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } @@ -141,6 +146,11 @@ class RecvChunkStatusCommand : public BasicCommand { public: RecvChunkStatusCommand() : BasicCommand("_recvChunkStatus") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } @@ -180,6 +190,11 @@ class RecvChunkCommitCommand : public BasicCommand { public: RecvChunkCommitCommand() : BasicCommand("_recvChunkCommit") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } @@ -229,6 +244,11 @@ class RecvChunkAbortCommand : public BasicCommand { public: RecvChunkAbortCommand() : BasicCommand("_recvChunkAbort") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "internal"; } diff --git a/src/mongo/db/s/shardsvr_abort_reshard_collection_command.cpp b/src/mongo/db/s/shardsvr_abort_reshard_collection_command.cpp index 8f46f3a2128..f28143f1d3a 100644 --- a/src/mongo/db/s/shardsvr_abort_reshard_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_abort_reshard_collection_command.cpp @@ -147,6 +147,11 @@ public: } }; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is exported by the shard server. Do not call directly. " "Aborts any in-progress resharding operations."; diff --git a/src/mongo/db/s/shardsvr_cleanup_reshard_collection_command.cpp b/src/mongo/db/s/shardsvr_cleanup_reshard_collection_command.cpp index 7aed4d418db..b58a8ca9915 100644 --- a/src/mongo/db/s/shardsvr_cleanup_reshard_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_cleanup_reshard_collection_command.cpp @@ -87,6 +87,11 @@ public: } }; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is exported by the shard server. Do not call directly. " "Aborts and cleans up any in-progress resharding operations for this collection."; diff --git a/src/mongo/db/s/shardsvr_commit_reshard_collection_command.cpp b/src/mongo/db/s/shardsvr_commit_reshard_collection_command.cpp index d592c22f19c..9506f46523a 100644 --- a/src/mongo/db/s/shardsvr_commit_reshard_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_commit_reshard_collection_command.cpp @@ -148,6 +148,11 @@ public: } }; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is exported by the shard server. Do not call directly. " "Commits an in-progress resharding operations"; diff --git a/src/mongo/db/s/shardsvr_create_collection_command.cpp b/src/mongo/db/s/shardsvr_create_collection_command.cpp index 644e396196a..8972b9d1600 100644 --- a/src/mongo/db/s/shardsvr_create_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_create_collection_command.cpp @@ -47,6 +47,11 @@ public: using Request = ShardsvrCreateCollection; using Response = CreateCollectionResponse; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Creates a collection."; } diff --git a/src/mongo/db/s/shardsvr_create_collection_participant_command.cpp b/src/mongo/db/s/shardsvr_create_collection_participant_command.cpp index e49c2d78aac..128a132fcb7 100644 --- a/src/mongo/db/s/shardsvr_create_collection_participant_command.cpp +++ b/src/mongo/db/s/shardsvr_create_collection_participant_command.cpp @@ -48,6 +48,11 @@ public: return false; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Creates a collection."; } diff --git a/src/mongo/db/s/shardsvr_drop_collection_command.cpp b/src/mongo/db/s/shardsvr_drop_collection_command.cpp index fc153e1de67..0e5f5146adf 100644 --- a/src/mongo/db/s/shardsvr_drop_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_collection_command.cpp @@ -52,7 +52,7 @@ public: } bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } diff --git a/src/mongo/db/s/shardsvr_drop_collection_participant_command.cpp b/src/mongo/db/s/shardsvr_drop_collection_participant_command.cpp index d480b858507..35572f58d9a 100644 --- a/src/mongo/db/s/shardsvr_drop_collection_participant_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_collection_participant_command.cpp @@ -47,7 +47,7 @@ class ShardsvrDropCollectionParticipantCommand final : public TypedCommand<ShardsvrDropCollectionParticipantCommand> { public: bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } diff --git a/src/mongo/db/s/shardsvr_drop_database_command.cpp b/src/mongo/db/s/shardsvr_drop_database_command.cpp index b6051cb8008..08e49131c98 100644 --- a/src/mongo/db/s/shardsvr_drop_database_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_database_command.cpp @@ -53,7 +53,7 @@ public: } bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } diff --git a/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp b/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp index e6b65c067a8..04fbdb2a779 100644 --- a/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp @@ -47,7 +47,7 @@ class ShardsvrDropDatabaseParticipantCommand final : public TypedCommand<ShardsvrDropDatabaseParticipantCommand> { public: bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } diff --git a/src/mongo/db/s/shardsvr_move_primary_command.cpp b/src/mongo/db/s/shardsvr_move_primary_command.cpp index 4abf7d7af5c..de96165a672 100644 --- a/src/mongo/db/s/shardsvr_move_primary_command.cpp +++ b/src/mongo/db/s/shardsvr_move_primary_command.cpp @@ -45,6 +45,11 @@ class MovePrimaryCommand : public BasicCommand { public: MovePrimaryCommand() : BasicCommand("_shardsvrMovePrimary") {} + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "should not be calling this directly"; } 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 bab84ffbebe..fdd0c12131c 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 @@ -41,15 +41,15 @@ namespace { class ShardsvrRefineCollectionShardKeyCommand final : public TypedCommand<ShardsvrRefineCollectionShardKeyCommand> { public: - bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ - return true; - } - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return Command::AllowedOnSecondary::kNever; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command, which is exported by the primary sharding server. Do not call " "directly. Refines Collection shard key."; diff --git a/src/mongo/db/s/shardsvr_rename_collection_command.cpp b/src/mongo/db/s/shardsvr_rename_collection_command.cpp index b11d2c2f2cb..3cceae99c84 100644 --- a/src/mongo/db/s/shardsvr_rename_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_rename_collection_command.cpp @@ -48,6 +48,11 @@ public: using Request = ShardsvrRenameCollection; using Response = RenameCollectionResponse; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Renames a collection."; } diff --git a/src/mongo/db/s/shardsvr_rename_collection_participant_command.cpp b/src/mongo/db/s/shardsvr_rename_collection_participant_command.cpp index 10544a7a640..b31c7802e4c 100644 --- a/src/mongo/db/s/shardsvr_rename_collection_participant_command.cpp +++ b/src/mongo/db/s/shardsvr_rename_collection_participant_command.cpp @@ -51,6 +51,11 @@ public: return false; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Locally renames a collection."; } @@ -123,6 +128,11 @@ public: return false; } + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Releases the critical section of source " "and target collections."; diff --git a/src/mongo/db/s/shardsvr_reshard_collection_command.cpp b/src/mongo/db/s/shardsvr_reshard_collection_command.cpp index 21c309d925c..1427d27dcfd 100644 --- a/src/mongo/db/s/shardsvr_reshard_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_reshard_collection_command.cpp @@ -46,6 +46,11 @@ class ShardsvrReshardCollectionCommand final public: using Request = ShardsvrReshardCollection; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command. Do not call directly. Reshards a collection."; } diff --git a/src/mongo/db/s/shardsvr_resharding_operation_time_command.cpp b/src/mongo/db/s/shardsvr_resharding_operation_time_command.cpp index 9fc2b30a231..f15435d52e7 100644 --- a/src/mongo/db/s/shardsvr_resharding_operation_time_command.cpp +++ b/src/mongo/db/s/shardsvr_resharding_operation_time_command.cpp @@ -64,6 +64,11 @@ public: using Request = _shardsvrReshardingOperationTime; using Response = OperationTime; + bool skipApiVersionCheck() const override { + // Internal command (server to server). + return true; + } + std::string help() const override { return "Internal command used by the resharding coordinator to query the elapsed and " "remaining time for the active resharding operation on participant shards."; diff --git a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp index 3fce3dda429..c9d81e668ee 100644 --- a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp +++ b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp @@ -52,7 +52,7 @@ MONGO_FAIL_POINT_DEFINE(participantReturnNetworkErrorForPrepareAfterExecutingPre class PrepareTransactionCmd : public TypedCommand<PrepareTransactionCmd> { public: bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } @@ -230,7 +230,7 @@ public: using Request = CoordinateCommitTransaction; bool skipApiVersionCheck() const override { - /* Internal command (server to server) */ + // Internal command (server to server). return true; } |