diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2020-08-25 09:12:01 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-25 21:08:44 +0000 |
commit | edfe9d2737656626b77543047215c4dfb9d0b23f (patch) | |
tree | 9016a0ab33e880f146172c89e1557a2168b97a3d /src | |
parent | 152ea482d58e610e12539cec0be3c4f03e30a213 (diff) | |
download | mongo-edfe9d2737656626b77543047215c4dfb9d0b23f.tar.gz |
SERVER-50242 Don't log awaitable "hello" as slow query
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/service_entry_point_mongos.cpp | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 91cc4dd27e0..c14330262c0 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -1725,7 +1725,7 @@ Future<DbResponse> ServiceEntryPointCommon::handleRequest(OperationContext* opCt DbResponse dbresponse; if (op == dbMsg || (op == dbQuery && isCommand)) { dbresponse = receivedCommands(opCtx, m, behaviors); - // IsMaster should take kMaxAwaitTimeMs at most, log if it takes twice that. + // Hello should take kMaxAwaitTimeMs at most, log if it takes twice that. if (auto command = currentOp.getCommand(); command && (command->getName() == "hello")) { slowMsOverride = 2 * durationCount<Milliseconds>(SingleServerIsMasterMonitor::kMaxAwaitTime); diff --git a/src/mongo/s/service_entry_point_mongos.cpp b/src/mongo/s/service_entry_point_mongos.cpp index 5df65b3e718..a10cec0ee7b 100644 --- a/src/mongo/s/service_entry_point_mongos.cpp +++ b/src/mongo/s/service_entry_point_mongos.cpp @@ -33,6 +33,7 @@ #include "mongo/s/service_entry_point_mongos.h" +#include "mongo/client/server_is_master_monitor.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" #include "mongo/db/curop.h" @@ -91,9 +92,17 @@ Future<DbResponse> ServiceEntryPointMongos::handleRequest(OperationContext* opCt if (op == dbMsg || (op == dbQuery && NamespaceString(dbm.getns()).isCommand())) { auto dbResponse = Strategy::clientCommand(opCtx, message); + // Hello should take kMaxAwaitTimeMs at most, log if it takes twice that. + boost::optional<long long> slowMsOverride; + if (auto command = CurOp::get(opCtx)->getCommand(); + command && (command->getName() == "hello")) { + slowMsOverride = + 2 * durationCount<Milliseconds>(SingleServerIsMasterMonitor::kMaxAwaitTime); + } + // Mark the op as complete, populate the response length, and log it if appropriate. CurOp::get(opCtx)->completeAndLogOperation( - opCtx, logv2::LogComponent::kCommand, dbResponse.response.size()); + opCtx, logv2::LogComponent::kCommand, dbResponse.response.size(), slowMsOverride); return Future<DbResponse>::makeReady(std::move(dbResponse)); } |