diff options
Diffstat (limited to 'src/mongo/s/commands/strategy.cpp')
-rw-r--r-- | src/mongo/s/commands/strategy.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp index 81eee3ef4bc..f90d6d1beb6 100644 --- a/src/mongo/s/commands/strategy.cpp +++ b/src/mongo/s/commands/strategy.cpp @@ -296,9 +296,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) { @@ -311,6 +312,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 @@ -1023,14 +1032,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 { @@ -1040,7 +1041,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}", @@ -1232,7 +1233,7 @@ void Strategy::writeOp(OperationContext* opCtx, DbMessage* dbm) { MONGO_UNREACHABLE; } }(), - msg.operation(), + msg, &reply, &errorBuilder); // built objects are ignored } |