diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-10-05 11:04:30 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-10-10 09:58:45 -0400 |
commit | 5c4de620a563aebf3360b3e7d3533aba9ad30bd0 (patch) | |
tree | ca9a67c3f8fd2a96bdd5271590efbbaf0cdefbd5 /src/mongo/db/s/sharding_state.h | |
parent | e6e4a046ef172735f31693ced1d7b0b22da7c081 (diff) | |
download | mongo-5c4de620a563aebf3360b3e7d3533aba9ad30bd0.tar.gz |
SERVER-26340 ShardingState::setShardName should be called under initializeFromConfigConnString's "lock"
Diffstat (limited to 'src/mongo/db/s/sharding_state.h')
-rw-r--r-- | src/mongo/db/s/sharding_state.h | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/mongo/db/s/sharding_state.h b/src/mongo/db/s/sharding_state.h index 6fca53dff89..8481c282bed 100644 --- a/src/mongo/db/s/sharding_state.h +++ b/src/mongo/db/s/sharding_state.h @@ -115,7 +115,9 @@ public: * Note that this will also try to connect to the config servers and will block until it * succeeds. */ - void initializeFromConfigConnString(OperationContext* txn, const std::string& configSvr); + void initializeFromConfigConnString(OperationContext* txn, + const std::string& configSvr, + const std::string shardName); /** * Initializes the sharding state of this server from the shard identity document argument. @@ -134,18 +136,6 @@ public: */ Status updateConfigServerOpTimeFromMetadata(OperationContext* txn); - /** - * Assigns a shard name to this MongoD instance. - * TODO: The only reason we need this method and cannot merge it together with the initialize - * call is the setShardVersion request being sent by the config coordinator to the config server - * instances. This is the only command, which does not include shard name and once we get rid of - * the legacy style config servers, we can merge these methods. - * - * Throws an error if shard name has always been set and the newly specified value does not - * match what was previously installed. - */ - void setShardName(const std::string& shardName); - CollectionShardingState* getNS(const std::string& ns, OperationContext* txn); /** @@ -325,8 +315,9 @@ private: * terminated. * * @param configSvr Connection string of the config server to use. + * @param shardName the name of the shard in config.shards */ - void _initializeImpl(ConnectionString configSvr); + void _initializeImpl(ConnectionString configSvr, std::string shardName); /** * Must be called only when the current state is kInitializing. Sets the current state to |