summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavi Vetriselvan <pvselvan@umich.edu>2019-06-27 11:10:30 -0400
committerPavi Vetriselvan <pvselvan@umich.edu>2019-07-02 13:54:35 -0400
commit89a719b5fcac9bbe5ce9369939cba2bc24735b26 (patch)
tree7fd47bfe173ea552a31fbadafde4236e3819445f /src
parentc27638adedd3fbac4d560cc2be466c8fa2ddf314 (diff)
downloadmongo-89a719b5fcac9bbe5ce9369939cba2bc24735b26.tar.gz
SERVER-36824 prevent prepareTransaction command on standalone
(cherry picked from commit 78f534fa92809fd3b9366a046fa5d24988b32944)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/txn_two_phase_commit_cmds.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp
index e7369ceb69c..1dd07473d67 100644
--- a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp
+++ b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp
@@ -85,6 +85,11 @@ public:
"'prepareTransaction' is not supported for replica sets with arbiters",
!replCoord->setContainsArbiter());
+ // We do not allow the prepareTransaction command to run on a standalone.
+ uassert(51239,
+ "'prepareTransaction' is not supported on standalone nodes.",
+ replCoord->isReplEnabled());
+
auto txnParticipant = TransactionParticipant::get(opCtx);
uassert(ErrorCodes::CommandFailed,
"prepareTransaction must be run within a transaction",