summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/explain_cmd.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2018-10-23 16:38:34 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2018-11-15 10:44:12 -0500
commit06dd323b423deccb5fbb650ddbed0135c00191d2 (patch)
tree0ec8cc6ceeca6cd193a17395b62bc35e90c4c5e2 /src/mongo/db/commands/explain_cmd.cpp
parent96fac450b996d2f038ae8f20883f34e857b6bd96 (diff)
downloadmongo-06dd323b423deccb5fbb650ddbed0135c00191d2.tar.gz
SERVER-37189 Record metrics correctly for transactions that fail prior to unstash
Diffstat (limited to 'src/mongo/db/commands/explain_cmd.cpp')
-rw-r--r--src/mongo/db/commands/explain_cmd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp
index cd03d5d21da..68fc92295da 100644
--- a/src/mongo/db/commands/explain_cmd.cpp
+++ b/src/mongo/db/commands/explain_cmd.cpp
@@ -95,10 +95,13 @@ public:
_innerInvocation{std::move(innerInvocation)} {}
void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) override {
+ // Explain is never allowed in multi-document transactions.
+ const bool inMultiDocumentTransaction = false;
uassert(50746,
"Explain's child command cannot run on this node. "
"Are you explaining a write command on a secondary?",
- commandCanRunHere(opCtx, _dbName, _innerInvocation->definition()));
+ commandCanRunHere(
+ opCtx, _dbName, _innerInvocation->definition(), inMultiDocumentTransaction));
_innerInvocation->explain(opCtx, _verbosity, result);
}