summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-08-04 12:51:12 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-09 14:09:37 +0000
commit137858b32e8a81d681e8a5e92845424671c8da36 (patch)
tree7d9c0c2bcdec219ee164349777cb56d7680abd8c /src/mongo/s
parentbb917c502bd71702a71057f9bf7237207cbac4ff (diff)
downloadmongo-137858b32e8a81d681e8a5e92845424671c8da36.tar.gz
SERVER-50097 isMaster aliases should correctly populate exhaustIsMasterMetrics
(cherry picked from commit 9e4b6e5c2f9e266ed05ce7c913631f12548e4160)
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/commands/strategy.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index 7d4e5912fa3..52c65dd69d2 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -354,9 +354,10 @@ MONGO_FAIL_POINT_DEFINE(doNotRefreshShardsOnRetargettingError);
*/
void runCommand(OperationContext* opCtx,
const OpMsgRequest& request,
- const NetworkOp opType,
+ const Message& m,
rpc::ReplyBuilderInterface* replyBuilder,
BSONObjBuilder* errorBuilder) {
+ auto const opType = m.operation();
auto const commandName = request.getCommandName();
auto const command = CommandHelpers::findCommand(commandName);
if (!command) {
@@ -369,6 +370,14 @@ void runCommand(OperationContext* opCtx,
return;
}
+ opCtx->setExhaust(OpMsg::isFlagSet(m, OpMsg::kExhaustSupported));
+ const auto session = opCtx->getClient()->session();
+ if (session) {
+ if (!opCtx->isExhaust() || command->getName() != "isMaster"_sd) {
+ InExhaustIsMaster::get(session.get())->setInExhaustIsMaster(false);
+ }
+ }
+
CommandHelpers::uassertShouldAttemptParse(opCtx, command, request);
// Parse the 'maxTimeMS' command option, and use it to set a deadline for the operation on
@@ -1038,14 +1047,6 @@ DbResponse Strategy::clientCommand(OperationContext* opCtx, const Message& m) {
}
}();
- opCtx->setExhaust(OpMsg::isFlagSet(m, OpMsg::kExhaustSupported));
- const auto session = opCtx->getClient()->session();
- if (session) {
- if (!opCtx->isExhaust() || request.getCommandName() != "isMaster"_sd) {
- InExhaustIsMaster::get(session.get())->setInExhaustIsMaster(false);
- }
- }
-
// Execute.
std::string db = request.getDatabase().toString();
try {
@@ -1055,7 +1056,7 @@ DbResponse Strategy::clientCommand(OperationContext* opCtx, const Message& m) {
"Command begin",
"db"_attr = db,
"headerId"_attr = m.header().getId());
- runCommand(opCtx, request, m.operation(), reply.get(), &errorBuilder);
+ runCommand(opCtx, request, m, reply.get(), &errorBuilder);
LOGV2_DEBUG(22771,
3,
"Command end db: {db} msg id: {headerId}",
@@ -1273,7 +1274,7 @@ void Strategy::writeOp(OperationContext* opCtx, DbMessage* dbm) {
MONGO_UNREACHABLE;
}
}(),
- msg.operation(),
+ msg,
&reply,
&errorBuilder); // built objects are ignored
}