summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Vitor Morilha <daniel.morilha@mongodb.com>2022-01-07 20:51:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-10 16:25:27 +0000
commit14a754e2511ff668b4d61e7598ec3ce088cdcc9a (patch)
treed3bf7927a28101354f42eb27f1181a5e03fed89f /src
parenta4abad42efb8a44b4b3fa40831e50060530b9938 (diff)
downloadmongo-14a754e2511ff668b4d61e7598ec3ce088cdcc9a.tar.gz
Revert "SERVER-55055 Add cumulative metric for the total refreshed connections"
This reverts commit 4ae8b3f29485b8a25877b8fd7e67787e9b3996de.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/client/connpool.cpp1
-rw-r--r--src/mongo/executor/connection_pool.cpp31
-rw-r--r--src/mongo/executor/connection_pool_stats.cpp21
-rw-r--r--src/mongo/executor/connection_pool_stats.h6
4 files changed, 10 insertions, 49 deletions
diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp
index e52bd54d102..3a396fa782b 100644
--- a/src/mongo/client/connpool.cpp
+++ b/src/mongo/client/connpool.cpp
@@ -590,7 +590,6 @@ void DBConnectionPool::appendConnectionStats(executor::ConnectionPoolStats* stat
executor::ConnectionStatsPer hostStats{static_cast<size_t>(i->second.numInUse()),
static_cast<size_t>(i->second.numAvailable()),
static_cast<size_t>(i->second.numCreated()),
- 0,
0};
stats->updateStatsForHost("global", host, hostStats);
}
diff --git a/src/mongo/executor/connection_pool.cpp b/src/mongo/executor/connection_pool.cpp
index 9e562057d38..1fa7790a300 100644
--- a/src/mongo/executor/connection_pool.cpp
+++ b/src/mongo/executor/connection_pool.cpp
@@ -61,8 +61,6 @@ namespace mongo {
namespace {
-MONGO_FAIL_POINT_DEFINE(refreshConnectionAfterEveryCommand);
-
auto makeSeveritySuppressor() {
return std::make_unique<logv2::KeyedSeveritySuppressor<HostAndPort>>(
Seconds{1}, logv2::LogSeverity::Log(), logv2::LogSeverity::Debug(2));
@@ -308,11 +306,6 @@ public:
size_t refreshingConnections() const;
/**
- * Returns the number of all refreshed connections in the pool.
- */
- size_t refreshedConnections() const;
-
- /**
* Returns the total number of connections ever created in this pool.
*/
size_t createdConnections() const;
@@ -435,8 +428,6 @@ private:
size_t _created = 0;
- size_t _refreshed = 0;
-
transport::Session::TagMask _tags = transport::Session::kPending;
HostHealth _health;
@@ -591,8 +582,7 @@ void ConnectionPool::appendConnectionStats(ConnectionPoolStats* stats) const {
ConnectionStatsPer hostStats{pool->inUseConnections(),
pool->availableConnections(),
pool->createdConnections(),
- pool->refreshingConnections(),
- pool->refreshedConnections()};
+ pool->refreshingConnections()};
stats->updateStatsForHost(_name, host, hostStats);
}
}
@@ -640,10 +630,6 @@ size_t ConnectionPool::SpecificPool::refreshingConnections() const {
return _processingPool.size();
}
-size_t ConnectionPool::SpecificPool::refreshedConnections() const {
- return _refreshed;
-}
-
size_t ConnectionPool::SpecificPool::createdConnections() const {
return _created;
}
@@ -744,10 +730,6 @@ ConnectionPool::ConnectionHandle ConnectionPool::SpecificPool::tryGetConnection(
void ConnectionPool::SpecificPool::finishRefresh(ConnectionInterface* connPtr, Status status) {
auto conn = takeFromProcessingPool(connPtr);
- // We increment the total number of refreshed connections right upfront to track all completed
- // refreshes.
- _refreshed++;
-
// If we're in shutdown, we don't need refreshed connections
if (_health.isShutdown) {
return;
@@ -832,15 +814,10 @@ void ConnectionPool::SpecificPool::returnConnection(ConnectionInterface* connPtr
return;
}
- // If we need to refresh this connection
- bool shouldRefreshConnection = needsRefreshTP <= _parent->_factory->now();
-
- if (MONGO_unlikely(refreshConnectionAfterEveryCommand.shouldFail())) {
- LOGV2(5505501, "refresh connection after every command is on");
- shouldRefreshConnection = true;
- }
+ auto now = _parent->_factory->now();
+ if (needsRefreshTP <= now) {
+ // If we need to refresh this connection
- if (shouldRefreshConnection) {
auto controls = _parent->_controller->getControls(_id);
if (_readyPool.size() + _processingPool.size() + _checkedOutPool.size() >=
controls.targetConnections) {
diff --git a/src/mongo/executor/connection_pool_stats.cpp b/src/mongo/executor/connection_pool_stats.cpp
index a3d1e1fb0b1..843a19a1a27 100644
--- a/src/mongo/executor/connection_pool_stats.cpp
+++ b/src/mongo/executor/connection_pool_stats.cpp
@@ -36,13 +36,11 @@
namespace mongo {
namespace executor {
-ConnectionStatsPer::ConnectionStatsPer(
- size_t nInUse, size_t nAvailable, size_t nCreated, size_t nRefreshing, size_t nRefreshed)
- : inUse(nInUse),
- available(nAvailable),
- created(nCreated),
- refreshing(nRefreshing),
- refreshed(nRefreshed) {}
+ConnectionStatsPer::ConnectionStatsPer(size_t nInUse,
+ size_t nAvailable,
+ size_t nCreated,
+ size_t nRefreshing)
+ : inUse(nInUse), available(nAvailable), created(nCreated), refreshing(nRefreshing) {}
ConnectionStatsPer::ConnectionStatsPer() = default;
@@ -51,7 +49,6 @@ ConnectionStatsPer& ConnectionStatsPer::operator+=(const ConnectionStatsPer& oth
available += other.available;
created += other.created;
refreshing += other.refreshing;
- refreshed += other.refreshed;
return *this;
}
@@ -77,7 +74,6 @@ void ConnectionPoolStats::updateStatsForHost(std::string pool,
totalAvailable += newStats.available;
totalCreated += newStats.created;
totalRefreshing += newStats.refreshing;
- totalRefreshed += newStats.refreshed;
}
void ConnectionPoolStats::appendToBSON(mongo::BSONObjBuilder& result, bool forFTDC) {
@@ -85,7 +81,6 @@ void ConnectionPoolStats::appendToBSON(mongo::BSONObjBuilder& result, bool forFT
result.appendNumber("totalAvailable", static_cast<long long>(totalAvailable));
result.appendNumber("totalCreated", static_cast<long long>(totalCreated));
result.appendNumber("totalRefreshing", static_cast<long long>(totalRefreshing));
- result.appendNumber("totalRefreshed", static_cast<long long>(totalRefreshed));
if (forFTDC) {
BSONObjBuilder poolBuilder(result.subobjStart("connectionsInUsePerPool"));
@@ -103,7 +98,6 @@ void ConnectionPoolStats::appendToBSON(mongo::BSONObjBuilder& result, bool forFT
return;
}
- // Process pools stats.
{
if (strategy) {
result.append("replicaSetMatchingStrategy", matchingStrategyToString(*strategy));
@@ -117,7 +111,6 @@ void ConnectionPoolStats::appendToBSON(mongo::BSONObjBuilder& result, bool forFT
poolInfo.appendNumber("poolAvailable", static_cast<long long>(poolStats.available));
poolInfo.appendNumber("poolCreated", static_cast<long long>(poolStats.created));
poolInfo.appendNumber("poolRefreshing", static_cast<long long>(poolStats.refreshing));
- poolInfo.appendNumber("poolRefreshed", static_cast<long long>(poolStats.refreshed));
for (const auto& host : poolStats.statsByHost) {
BSONObjBuilder hostInfo(poolInfo.subobjStart(host.first.toString()));
@@ -126,12 +119,9 @@ void ConnectionPoolStats::appendToBSON(mongo::BSONObjBuilder& result, bool forFT
hostInfo.appendNumber("available", static_cast<long long>(hostStats.available));
hostInfo.appendNumber("created", static_cast<long long>(hostStats.created));
hostInfo.appendNumber("refreshing", static_cast<long long>(hostStats.refreshing));
- hostInfo.appendNumber("refreshed", static_cast<long long>(hostStats.refreshed));
}
}
}
-
- // Processes hosts stats.
{
BSONObjBuilder hostBuilder(result.subobjStart("hosts"));
for (auto&& host : statsByHost) {
@@ -141,7 +131,6 @@ void ConnectionPoolStats::appendToBSON(mongo::BSONObjBuilder& result, bool forFT
hostInfo.appendNumber("available", static_cast<long long>(hostStats.available));
hostInfo.appendNumber("created", static_cast<long long>(hostStats.created));
hostInfo.appendNumber("refreshing", static_cast<long long>(hostStats.refreshing));
- hostInfo.appendNumber("refreshed", static_cast<long long>(hostStats.refreshed));
}
}
}
diff --git a/src/mongo/executor/connection_pool_stats.h b/src/mongo/executor/connection_pool_stats.h
index a96739b42be..3f9235040eb 100644
--- a/src/mongo/executor/connection_pool_stats.h
+++ b/src/mongo/executor/connection_pool_stats.h
@@ -41,8 +41,7 @@ namespace executor {
* a parent ConnectionPoolStats object and should not need to be created directly.
*/
struct ConnectionStatsPer {
- ConnectionStatsPer(
- size_t nInUse, size_t nAvailable, size_t nCreated, size_t nRefreshing, size_t nRefreshed);
+ ConnectionStatsPer(size_t nInUse, size_t nAvailable, size_t nCreated, size_t nRefreshing);
ConnectionStatsPer();
@@ -52,7 +51,6 @@ struct ConnectionStatsPer {
size_t available = 0u;
size_t created = 0u;
size_t refreshing = 0u;
- size_t refreshed = 0u;
};
/**
@@ -63,14 +61,12 @@ struct ConnectionStatsPer {
struct ConnectionPoolStats {
void updateStatsForHost(std::string pool, HostAndPort host, ConnectionStatsPer newStats);
- // FTDC : Full Time Diagnostic Data Collection
void appendToBSON(mongo::BSONObjBuilder& result, bool forFTDC = false);
size_t totalInUse = 0u;
size_t totalAvailable = 0u;
size_t totalCreated = 0u;
size_t totalRefreshing = 0u;
- size_t totalRefreshed = 0u;
boost::optional<ShardingTaskExecutorPoolController::MatchingStrategy> strategy;
using StatsByHost = std::map<HostAndPort, ConnectionStatsPer>;