summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2017-04-16 09:42:20 -0400
committersamantharitter <samantha.ritter@10gen.com>2017-04-16 09:42:20 -0400
commit932c2f345598d8e1d283e8c2bb54fd8d0e11c853 (patch)
tree4c0346c79755a5d244c874ae8e6a3c903417d9d1
parenta3db68bfea74c748e6bc1a5dafb60d6519174306 (diff)
downloadmongo-932c2f345598d8e1d283e8c2bb54fd8d0e11c853.tar.gz
Revert "SERVER-28760 Add egress logging to DBConnectionPool"
This reverts commit 0dc375a32b24a65fd93e6d669aca05f7309f78df.
-rw-r--r--src/mongo/client/connpool.cpp31
-rw-r--r--src/mongo/client/connpool.h20
2 files changed, 5 insertions, 46 deletions
diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp
index 8fd4a5f1b8b..9ad9d62bb5e 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)";
-
_pool = decltype(_pool){};
}
@@ -83,17 +80,11 @@ void PoolForHost::done(DBConnectionPool* pool, DBClientBase* c_raw) {
bool isBroken = c->getSockCreationMicroSec() < _minValidCreationTimeMicroSec;
if (isFailed || isBroken) {
_badConns++;
- 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.get());
- } else if (_maxPoolSize >= 0 && static_cast<int>(_pool.size()) >= _maxPoolSize) {
+ }
+
+ if (isFailed || isBroken ||
// 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.get());
} else {
// The connection is probably fine, save for later
@@ -106,7 +97,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();
}
@@ -198,17 +189,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& ident,
double socketTimeout,
DBClientBase* conn) {
@@ -228,10 +212,6 @@ DBClientBase* DBConnectionPool::_finishCreate(const string& ident,
throw;
}
- log() << "Successfully connected to " << ident << " (" << openConnections(ident, socketTimeout)
- << " connections now open to " << ident << " with a " << socketTimeout
- << " second timeout)";
-
return conn;
}
@@ -279,7 +259,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 7ce7022390e..4599a6fdf30 100644
--- a/src/mongo/client/connpool.h
+++ b/src/mongo/client/connpool.h
@@ -103,13 +103,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();
}
@@ -118,13 +111,6 @@ public:
return _checkedOut;
}
- /**
- * Returns the number of open connections in this pool.
- */
- int openConnections() const {
- return numInUse() + numAvailable();
- }
-
void createdOne(DBClientBase* base);
long long numCreated() const {
return _created;
@@ -177,7 +163,6 @@ private:
};
std::string _hostName;
- double _socketTimeout;
std::stack<StoredConnection> _pool;
int64_t _created;
@@ -239,11 +224,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