We might indeed be off by a few connections in the "maximum connections
seen" counter, but we don't care that much.
qps.addHit();
}
+ void incCurrentConnectionsCount();
+
private:
std::string name;
std::string nameWithAddr;
tid.detach();
}
}
+
+void DownstreamState::incCurrentConnectionsCount()
+{
+ auto currentConnectionsCount = ++tcpCurrentConnections;
+ if (currentConnectionsCount > tcpMaxConcurrentConnections) {
+ tcpMaxConcurrentConnections.store(currentConnectionsCount);
+ }
+}
d_queries = 0;
d_handler = std::move(handler);
- ++d_ds->tcpCurrentConnections;
- if (d_ds->tcpCurrentConnections > d_ds->tcpMaxConcurrentConnections) {
- d_ds->tcpMaxConcurrentConnections = d_ds->tcpCurrentConnections;
- }
+ d_ds->incCurrentConnectionsCount();
return true;
}
catch (const std::runtime_error& e) {
race:handleStats
race:ClientState::updateTCPMetrics
race:DownstreamState::updateTCPMetrics
+race:DownstreamState::incCurrentConnectionsCount
# There is a race when we update the status of a backend,
# but eventual consistency is fine there
race:DownstreamState::setDown