diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-17 13:59:50 -0400 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-05-04 13:10:54 -0400 |
commit | 8c01d9004fd3d9dcf5cab47a26948651a04a5d4d (patch) | |
tree | 1e300b4da6a50de72e6e82421bd30869f760ef12 /src/mongo/s | |
parent | 00db1ee9d23447d935edf893e3cf0875904fe999 (diff) | |
download | mongo-8c01d9004fd3d9dcf5cab47a26948651a04a5d4d.tar.gz |
SERVER-34214 convert some simple commands to TypedCommand
- _configsvrCreateDatabase
- _configsvrCreateCollection
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/commands/cluster_commands_helpers.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_create_cmd.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/request_types/create_collection.idl | 11 | ||||
-rw-r--r-- | src/mongo/s/request_types/create_database.idl | 11 |
4 files changed, 16 insertions, 18 deletions
diff --git a/src/mongo/s/commands/cluster_commands_helpers.cpp b/src/mongo/s/commands/cluster_commands_helpers.cpp index 7960dc22c11..9bdab8d5df0 100644 --- a/src/mongo/s/commands/cluster_commands_helpers.cpp +++ b/src/mongo/s/commands/cluster_commands_helpers.cpp @@ -501,8 +501,8 @@ bool appendEmptyResultSet(OperationContext* opCtx, StatusWith<CachedDatabaseInfo> createShardDatabase(OperationContext* opCtx, StringData dbName) { auto dbStatus = Grid::get(opCtx)->catalogCache()->getDatabase(opCtx, dbName); if (dbStatus == ErrorCodes::NamespaceNotFound) { - ConfigsvrCreateDatabase configCreateDatabaseRequest; - configCreateDatabaseRequest.set_configsvrCreateDatabase(dbName); + ConfigsvrCreateDatabase configCreateDatabaseRequest(dbName.toString()); + configCreateDatabaseRequest.setDbName(NamespaceString::kAdminDb); auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard(); @@ -512,7 +512,7 @@ StatusWith<CachedDatabaseInfo> createShardDatabase(OperationContext* opCtx, Stri ReadPreferenceSetting(ReadPreference::PrimaryOnly), "admin", CommandHelpers::appendMajorityWriteConcern( - configCreateDatabaseRequest.toBSON()), + configCreateDatabaseRequest.toBSON({})), Shard::RetryPolicy::kIdempotent)) .commandStatus; diff --git a/src/mongo/s/commands/cluster_create_cmd.cpp b/src/mongo/s/commands/cluster_create_cmd.cpp index bf8df8a8e54..be8c8f9dd4a 100644 --- a/src/mongo/s/commands/cluster_create_cmd.cpp +++ b/src/mongo/s/commands/cluster_create_cmd.cpp @@ -79,8 +79,8 @@ public: !cmdObj["capped"].trueValue() || cmdObj["size"].isNumber() || cmdObj.hasField("$nExtents")); - ConfigsvrCreateCollection configCreateCmd; - configCreateCmd.setNs(nss); + ConfigsvrCreateCollection configCreateCmd(nss); + configCreateCmd.setDbName(NamespaceString::kAdminDb); { BSONObjIterator cmdIter(cmdObj); @@ -97,7 +97,7 @@ public: ReadPreferenceSetting{ReadPreference::PrimaryOnly}, "admin", CommandHelpers::appendMajorityWriteConcern( - CommandHelpers::appendPassthroughFields(cmdObj, configCreateCmd.toBSON())), + CommandHelpers::appendPassthroughFields(cmdObj, configCreateCmd.toBSON({}))), Shard::RetryPolicy::kIdempotent); uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(response)); diff --git a/src/mongo/s/request_types/create_collection.idl b/src/mongo/s/request_types/create_collection.idl index d7257f1d599..94604b6f512 100644 --- a/src/mongo/s/request_types/create_collection.idl +++ b/src/mongo/s/request_types/create_collection.idl @@ -32,15 +32,14 @@ global: imports: - "mongo/idl/basic_types.idl" -structs: - ConfigsvrCreateCollection: +commands: + _configsvrCreateCollection: + cpp_name: ConfigsvrCreateCollection description: "The internal createCollection command on the config server" strict: false + namespace: type + type: namespacestring fields: - _configsvrCreateCollection: - cpp_name: ns - type: namespacestring - description: "The namespace of the collection to be created." options: type: object optional: true diff --git a/src/mongo/s/request_types/create_database.idl b/src/mongo/s/request_types/create_database.idl index f357a005778..83c42830075 100644 --- a/src/mongo/s/request_types/create_database.idl +++ b/src/mongo/s/request_types/create_database.idl @@ -32,11 +32,10 @@ global: imports: - "mongo/idl/basic_types.idl" -structs: - ConfigsvrCreateDatabase: +commands: + _configsvrCreateDatabase: + cpp_name : ConfigsvrCreateDatabase description: "The internal createDatabase command on the config server" strict: false - fields: - _configsvrCreateDatabase: - type: string - description: "The namespace of the database to be created."
\ No newline at end of file + namespace: type + type: string |