summaryrefslogtreecommitdiff
path: root/src/mongo/client/connpool.h
diff options
context:
space:
mode:
authorWaley Chen <waleycz@gmail.com>2016-10-24 13:43:55 -0400
committerWaley Chen <waleycz@gmail.com>2016-10-24 19:11:52 -0400
commitfe6ce934697d4f8d483829e275ef1f41d2d0e847 (patch)
treeb4defade1ce3e0bce98a6be3434b759f1851cfce /src/mongo/client/connpool.h
parentba79e00f95b6d4166a1ae9de73927021c389f478 (diff)
downloadmongo-fe6ce934697d4f8d483829e275ef1f41d2d0e847.tar.gz
SERVER-25183 scoped_db_conn_test.exe - DontReturnConnGoneBadToPool Failed
Diffstat (limited to 'src/mongo/client/connpool.h')
-rw-r--r--src/mongo/client/connpool.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h
index 509965971ff..86c5ae40735 100644
--- a/src/mongo/client/connpool.h
+++ b/src/mongo/client/connpool.h
@@ -62,11 +62,19 @@ public:
_minValidCreationTimeMicroSec(0),
_type(ConnectionString::INVALID),
_maxPoolSize(kPoolSizeUnlimited),
- _checkedOut(0) {}
+ _checkedOut(0),
+ _badConns(0) {}
~PoolForHost();
/**
+ * Returns the number of connections in this pool that went bad.
+ */
+ int getNumBadConns() const {
+ return _badConns;
+ }
+
+ /**
* Returns the maximum number of connections stored in the pool
*/
int getMaxPoolSize() {
@@ -133,7 +141,7 @@ private:
struct StoredConnection {
StoredConnection(DBClientBase* c);
- bool ok(time_t now);
+ bool ok();
DBClientBase* conn;
time_t when;
@@ -151,6 +159,9 @@ private:
// The number of currently active connections from this pool
int _checkedOut;
+
+ // The number of connections that we did not reuse because they went bad.
+ int _badConns;
};
class DBConnectionHook {
@@ -216,6 +227,7 @@ public:
DBClientBase* get(const std::string& host, double socketTimeout = 0);
DBClientBase* get(const ConnectionString& host, double socketTimeout = 0);
+ int getNumBadConns(const std::string& host, double socketTimeout = 0) const;
void release(const std::string& host, DBClientBase* c);