Skip to content

Commit

Permalink
SERVER-23036 Lock ShardRegistry mutex when accessing config server co…
Browse files Browse the repository at this point in the history
…nnection string
  • Loading branch information
stbrody committed Mar 10, 2016
1 parent a8c1b9c commit fe49173
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/mongo/s/client/shard_registry.cpp
Expand Up @@ -177,6 +177,11 @@ ShardRegistry::ShardRegistry(std::unique_ptr<RemoteCommandTargeterFactory> targe

ShardRegistry::~ShardRegistry() = default;

ConnectionString ShardRegistry::getConfigServerConnectionString() const {
stdx::lock_guard<stdx::mutex> lk(_mutex);
return _configServerCS;
}

void ShardRegistry::updateConfigServerConnectionString(ConnectionString configServerCS) {
stdx::lock_guard<stdx::mutex> lk(_mutex);
_updateConfigServerConnectionString_inlock(std::move(configServerCS));
Expand Down
4 changes: 1 addition & 3 deletions src/mongo/s/client/shard_registry.h
Expand Up @@ -125,9 +125,7 @@ class ShardRegistry {
return _network;
}

ConnectionString getConfigServerConnectionString() const {
return _configServerCS;
}
ConnectionString getConfigServerConnectionString() const;

/**
* Reloads the ShardRegistry based on the contents of the config server's config.shards
Expand Down

0 comments on commit fe49173

Please sign in to comment.