summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/strategy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands/strategy.cpp')
-rw-r--r--src/mongo/s/commands/strategy.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index b08550220d6..7d4e5912fa3 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -354,10 +354,9 @@ MONGO_FAIL_POINT_DEFINE(doNotRefreshShardsOnRetargettingError);
*/
void runCommand(OperationContext* opCtx,
const OpMsgRequest& request,
- const Message& m,
+ const NetworkOp opType,
rpc::ReplyBuilderInterface* replyBuilder,
BSONObjBuilder* errorBuilder) {
- auto const opType = m.operation();
auto const commandName = request.getCommandName();
auto const command = CommandHelpers::findCommand(commandName);
if (!command) {
@@ -370,14 +369,6 @@ 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() != "hello"_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
@@ -1047,6 +1038,14 @@ 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 {
@@ -1056,7 +1055,7 @@ DbResponse Strategy::clientCommand(OperationContext* opCtx, const Message& m) {
"Command begin",
"db"_attr = db,
"headerId"_attr = m.header().getId());
- runCommand(opCtx, request, m, reply.get(), &errorBuilder);
+ runCommand(opCtx, request, m.operation(), reply.get(), &errorBuilder);
LOGV2_DEBUG(22771,
3,
"Command end db: {db} msg id: {headerId}",
@@ -1274,7 +1273,7 @@ void Strategy::writeOp(OperationContext* opCtx, DbMessage* dbm) {
MONGO_UNREACHABLE;
}
}(),
- msg,
+ msg.operation(),
&reply,
&errorBuilder); // built objects are ignored
}