diff options
author | Randolph Tan <randolph@10gen.com> | 2018-03-19 17:09:17 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2018-03-21 18:27:08 -0400 |
commit | 42bd621113ac0ef29df87a523402c6b0091fd4b9 (patch) | |
tree | b96192b150631e2300c712e96097c830ebcafac2 /src | |
parent | daa7dbf7e4564fc38b946416e3240caeb3c59b3a (diff) | |
download | mongo-42bd621113ac0ef29df87a523402c6b0091fd4b9.tar.gz |
SERVER-33332 mongos create command should preserve wtimeout option given by user
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_create_cmd.cpp | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp index 8561e826f4f..511b7bdfae9 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp @@ -82,6 +82,7 @@ const Seconds kDefaultFindHostMaxWaitTime(20); const ReadPreferenceSetting kConfigReadSelector(ReadPreference::Nearest, TagSet{}); const WriteConcernOptions kNoWaitWriteConcern(1, WriteConcernOptions::SyncMode::UNSET, Seconds(0)); +const char kWriteConcernField[] = "writeConcern"; void checkForExistingChunks(OperationContext* opCtx, const NamespaceString& nss) { BSONObjBuilder countBuilder; @@ -653,11 +654,13 @@ void ShardingCatalogManager::createCollection(OperationContext* opCtx, BSONObjBuilder createCmdBuilder; createCmdBuilder.append("create", ns.coll()); collOptions.appendBSON(&createCmdBuilder); + createCmdBuilder.append(kWriteConcernField, opCtx->getWriteConcern().toBSON()); + auto swResponse = primaryShard->runCommandWithFixedRetryAttempts( opCtx, ReadPreferenceSetting{ReadPreference::PrimaryOnly}, ns.db().toString(), - CommandHelpers::appendMajorityWriteConcern(createCmdBuilder.obj()), + createCmdBuilder.obj(), Shard::RetryPolicy::kIdempotent); auto createStatus = Shard::CommandResponse::getEffectiveStatus(swResponse); diff --git a/src/mongo/s/commands/cluster_create_cmd.cpp b/src/mongo/s/commands/cluster_create_cmd.cpp index c9c93d1b593..37ad3d8c0fc 100644 --- a/src/mongo/s/commands/cluster_create_cmd.cpp +++ b/src/mongo/s/commands/cluster_create_cmd.cpp @@ -91,7 +91,8 @@ public: opCtx, ReadPreferenceSetting{ReadPreference::PrimaryOnly}, "admin", - CommandHelpers::appendMajorityWriteConcern(configCreateCmd.toBSON()), + CommandHelpers::appendMajorityWriteConcern( + CommandHelpers::appendPassthroughFields(cmdObj, configCreateCmd.toBSON())), Shard::RetryPolicy::kIdempotent); uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(response)); |