diff options
author | samantharitter <samantha.ritter@10gen.com> | 2017-04-16 09:46:56 -0400 |
---|---|---|
committer | samantharitter <samantha.ritter@10gen.com> | 2017-04-16 09:50:24 -0400 |
commit | 8ebe984f0c6cf959d1c9223f836badda742a54d2 (patch) | |
tree | 284799dd5f5f9207ba802a6f6eefa70b5bd7ec53 | |
parent | 35405a48079c58de51a46c929d892afdd423fc2a (diff) | |
download | mongo-8ebe984f0c6cf959d1c9223f836badda742a54d2.tar.gz |
Revert "SERVER-28760 Add egress logging to DBConnectionPool"
this reverts the following two commits:
934eb7d00a0d85ff6a209b6add038103eb247858
6a9cbff2c72a6953a00bc8fd339d1f74800e2dd7
-rw-r--r-- | src/mongo/client/connpool.cpp | 40 | ||||
-rw-r--r-- | src/mongo/client/connpool.h | 20 |
2 files changed, 5 insertions, 55 deletions
diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp index 40baf4d0222..e1549fc5491 100644 --- a/src/mongo/client/connpool.cpp +++ b/src/mongo/client/connpool.cpp @@ -62,9 +62,6 @@ PoolForHost::~PoolForHost() { } void PoolForHost::clear() { - log() << "Dropping all pooled connections to " << _hostName << "(with timeout of " - << _socketTimeout << " seconds)"; - while (!_pool.empty()) { StoredConnection sc = _pool.top(); delete sc.conn; @@ -83,19 +80,9 @@ void PoolForHost::done(DBConnectionPool* pool, DBClientBase* c) { if (isFailed || // Another (later) connection was reported as broken to this host - (c->getSockCreationMicroSec() < _minValidCreationTimeMicroSec)) { - log() << "Ending connection to host " << _hostName << "(with timeout of " << _socketTimeout - << " seconds)" - << " due to bad connection status; " << openConnections() - << " connections to that host remain open"; - pool->onDestroy(c); - delete c; - } else if (_maxPoolSize >= 0 && static_cast<int>(_pool.size()) >= _maxPoolSize) { + (c->getSockCreationMicroSec() < _minValidCreationTimeMicroSec) || // We have a pool size that we need to enforce - log() << "Ending idle connection to host " << _hostName << "(with timeout of " - << _socketTimeout << " seconds)" - << " because the pool meets constraints; " << openConnections() - << " connections to that host remain open"; + (_maxPoolSize >= 0 && static_cast<int>(_pool.size()) >= _maxPoolSize)) { pool->onDestroy(c); delete c; } else { @@ -109,7 +96,7 @@ void PoolForHost::reportBadConnectionAt(uint64_t microSec) { microSec > _minValidCreationTimeMicroSec) { _minValidCreationTimeMicroSec = microSec; log() << "Detected bad connection created at " << _minValidCreationTimeMicroSec - << " microSec, clearing pool for " << _hostName << " of " << openConnections() + << " microSec, clearing pool for " << _hostName << " of " << _pool.size() << " connections" << endl; clear(); } @@ -143,9 +130,6 @@ DBClientBase* PoolForHost::get(DBConnectionPool* pool, double socketTimeout) { } void PoolForHost::flush() { - log() << "Dropping all pooled connections to " << _hostName << "(with timeout of " - << _socketTimeout << " seconds)"; - while (!_pool.empty()) { StoredConnection c = _pool.top(); _pool.pop(); @@ -212,17 +196,10 @@ DBClientBase* DBConnectionPool::_get(const string& ident, double socketTimeout) stdx::lock_guard<stdx::mutex> L(_mutex); PoolForHost& p = _pools[PoolKey(ident, socketTimeout)]; p.setMaxPoolSize(_maxPoolSize); - p.setSocketTimeout(socketTimeout); p.initializeHostName(ident); return p.get(this, socketTimeout); } -int DBConnectionPool::openConnections(const string& ident, double socketTimeout) { - stdx::lock_guard<stdx::mutex> L(_mutex); - PoolForHost& p = _pools[PoolKey(ident, socketTimeout)]; - return p.openConnections(); -} - DBClientBase* DBConnectionPool::_finishCreate(const string& host, double socketTimeout, DBClientBase* conn) { @@ -242,17 +219,11 @@ DBClientBase* DBConnectionPool::_finishCreate(const string& host, throw; } - log() << "Successfully connected to " << host << " (" << openConnections(host, socketTimeout) - << " connections now open to " << host << " with a " << socketTimeout - << " second timeout)"; - return conn; } DBClientBase* DBConnectionPool::get(const ConnectionString& url, double socketTimeout) { - auto host = url.toString(); - - DBClientBase* c = _get(host, socketTimeout); + DBClientBase* c = _get(url.toString(), socketTimeout); if (c) { try { onHandedOut(c); @@ -265,7 +236,7 @@ DBClientBase* DBConnectionPool::get(const ConnectionString& url, double socketTi string errmsg; c = url.connect(errmsg, socketTimeout); - uassert(13328, _name + ": connect failed " + host + " : " + errmsg, c); + uassert(13328, _name + ": connect failed " + url.toString() + " : " + errmsg, c); return _finishCreate(url.toString(), socketTimeout, c); } @@ -291,7 +262,6 @@ DBClientBase* DBConnectionPool::get(const string& host, double socketTimeout) { host, 11002, str::stream() << _name << " error: " << errmsg); - return _finishCreate(host, socketTimeout, c); } diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h index c90aac3adfa..509965971ff 100644 --- a/src/mongo/client/connpool.h +++ b/src/mongo/client/connpool.h @@ -80,13 +80,6 @@ public: _maxPoolSize = maxPoolSize; } - /** - * Sets the socket timeout on this host, for reporting purposes only. - */ - void setSocketTimeout(double socketTimeout) { - _socketTimeout = socketTimeout; - } - int numAvailable() const { return (int)_pool.size(); } @@ -95,13 +88,6 @@ public: return _checkedOut; } - /** - * Returns the number of open connections in this pool. - */ - int openConnections() const { - return _checkedOut + (int)_pool.size(); - } - void createdOne(DBClientBase* base); long long numCreated() const { return _created; @@ -154,7 +140,6 @@ private: }; std::string _hostName; - double _socketTimeout; std::stack<StoredConnection> _pool; int64_t _created; @@ -213,11 +198,6 @@ public: } /** - * Returns the number of connections to the given host pool. - */ - int openConnections(const std::string& ident, double socketTimeout); - - /** * Sets the maximum number of connections pooled per-host. * * This setting only applies to new host connection pools, previously-pooled host pools are |