diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2020-12-08 10:54:56 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-12-08 20:25:49 +0000 |
commit | af18d77f83f12b0b5762cc0b4fe2059ab1d37e2c (patch) | |
tree | 37680d465a7c9c563c0ae40662f5850e870d81d3 /src/mongo/db | |
parent | b9dc4ecfa725ff31f01befe21625ecf8d65d94b2 (diff) | |
download | mongo-af18d77f83f12b0b5762cc0b4fe2059ab1d37e2c.tar.gz |
SERVER-53197 Don't log awaitable hello/ismaster as slow query
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/repl/replication_info.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 6 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index f35799db885..e42f773a8ca 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -40,6 +40,7 @@ #include "mongo/db/auth/sasl_mechanism_registry.h" #include "mongo/db/client.h" #include "mongo/db/commands/server_status.h" +#include "mongo/db/curop.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbhelpers.h" #include "mongo/db/exec/working_set_common.h" @@ -371,8 +372,10 @@ public: // present if and only if topologyVersion is present in the request. auto topologyVersionElement = cmdObj["topologyVersion"]; auto maxAwaitTimeMSField = cmdObj["maxAwaitTimeMS"]; + auto curOp = CurOp::get(opCtx); boost::optional<TopologyVersion> clientTopologyVersion; boost::optional<long long> maxAwaitTimeMS; + boost::optional<ScopeGuard<std::function<void()>>> timerGuard; if (topologyVersionElement && maxAwaitTimeMSField) { clientTopologyVersion = TopologyVersion::parse(IDLParserErrorContext("TopologyVersion"), topologyVersionElement.Obj()); @@ -391,8 +394,8 @@ public: LOGV2_DEBUG(23904, 3, "Using maxAwaitTimeMS for awaitable hello protocol."); - // Awaitable hello commands have high latency by design. - opCtx->setShouldIncrementLatencyStats(false); + curOp->pauseTimer(); + timerGuard.emplace([curOp]() { curOp->resumeTimer(); }); } else { uassert(31368, (topologyVersionElement @@ -427,6 +430,8 @@ public: auto currentTopologyVersion = appendReplicationInfo( opCtx, &result, 0, useLegacyResponseFields(), clientTopologyVersion, maxAwaitTimeMS); + timerGuard.reset(); // Resume curOp timer. + if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { const int configServerModeNumber = 2; result.append("configsvr", configServerModeNumber); diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index b2f23327dc1..7c73d67476f 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -628,12 +628,6 @@ private: ->setInExhaust(false, request.getCommandName()); } } - - // Hello should take kMaxAwaitTimeMs at most, log if it takes twice that. - if (isHello()) { - _execContext->slowMsOverride = - 2 * durationCount<Milliseconds>(SingleServerDiscoveryMonitor::kMaxAwaitTime); - } }); pf.promise.emplaceValue(); return future; |