diff options
author | Matt Cotter <matt.cotter@mongodb.com> | 2016-12-08 11:09:02 -0500 |
---|---|---|
committer | Matt Cotter <matt.cotter@mongodb.com> | 2016-12-13 11:50:42 -0500 |
commit | 26ff349e8108d6223628428494d8da5f0c31def5 (patch) | |
tree | e3627d209ef2a7ff6008f8f09a784273804ee3df /src/mongo/s/client | |
parent | 59d4a5c9f80078f73f81483ac807a25256d281bb (diff) | |
download | mongo-26ff349e8108d6223628428494d8da5f0c31def5.tar.gz |
SERVER-27325 deduplicate symbol `usingAShardConnection`
Diffstat (limited to 'src/mongo/s/client')
-rw-r--r-- | src/mongo/s/client/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/s/client/shard_connection.cpp | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/mongo/s/client/SConscript b/src/mongo/s/client/SConscript index 573d7a5c70b..6719c2cb248 100644 --- a/src/mongo/s/client/SConscript +++ b/src/mongo/s/client/SConscript @@ -19,6 +19,8 @@ env.Library( '$BUILD_DIR/mongo/executor/connection_pool_stats', '$BUILD_DIR/mongo/executor/task_executor_pool', '$BUILD_DIR/mongo/rpc/metadata', + '$BUILD_DIR/mongo/s/cluster_last_error_info', + '$BUILD_DIR/mongo/s/is_mongos', 'shard_interface', ], LIBDEPS_TAGS=[ diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp index 7e38ed59b9e..bbe562997c1 100644 --- a/src/mongo/s/client/shard_connection.cpp +++ b/src/mongo/s/client/shard_connection.cpp @@ -41,7 +41,9 @@ #include "mongo/s/client/shard.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/version_manager.h" +#include "mongo/s/cluster_last_error_info.h" #include "mongo/s/grid.h" +#include "mongo/s/is_mongos.h" #include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" @@ -401,9 +403,6 @@ thread_specific_ptr<ClientConnections> ClientConnections::_perThread; // The global connection pool DBConnectionPool shardConnectionPool; -// Different between mongos and mongod -void usingAShardConnection(const string& addr); - ShardConnection::ShardConnection(const ConnectionString& connectionString, const string& ns, std::shared_ptr<ChunkManager> manager) @@ -415,8 +414,13 @@ ShardConnection::ShardConnection(const ConnectionString& connectionString, invariant(_manager->getns() == _ns); } - _conn = ClientConnections::threadInstance()->get(_cs.toString(), _ns); - usingAShardConnection(_cs.toString()); + auto csString = _cs.toString(); + _conn = ClientConnections::threadInstance()->get(csString, _ns); + if (isMongos()) { + // In mongos, we record this connection as having been used for useful work to provide + // useful information in getLastError. + ClusterLastErrorInfo::get(cc()).addShardHost(csString); + } } ShardConnection::~ShardConnection() { |