diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-03-05 18:00:59 -0500 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-03-06 11:38:15 -0500 |
commit | 9bbce9db3d4a3ba73fb26cf32ffd5d8ecbe7e08b (patch) | |
tree | e2610183f919cd7f0555b16a9b3bac3ee8c9024d /src/mongo/s | |
parent | 260b3f451b95cab5f1e59be2d5f50a1cb78f2e5b (diff) | |
download | mongo-9bbce9db3d4a3ba73fb26cf32ffd5d8ecbe7e08b.tar.gz |
SERVER-39973 Router should not decide to use recovery commit path based on whether participant list is empty
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/transaction_router.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/transaction_router_test.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/s/transaction_router.cpp b/src/mongo/s/transaction_router.cpp index 51ca27d08b1..af5b386da5d 100644 --- a/src/mongo/s/transaction_router.cpp +++ b/src/mongo/s/transaction_router.cpp @@ -667,7 +667,7 @@ Shard::CommandResponse TransactionRouter::_commitMultiShardTransaction(Operation Shard::CommandResponse TransactionRouter::commitTransaction( OperationContext* opCtx, const boost::optional<TxnRecoveryToken>& recoveryToken) { - if (_participants.empty()) { + if (_isRecoveringCommit) { uassert(50940, "cannot commit with no participants", recoveryToken); return _commitWithRecoveryToken(opCtx, *recoveryToken); } diff --git a/src/mongo/s/transaction_router_test.cpp b/src/mongo/s/transaction_router_test.cpp index 58dbd4f8600..30e8a93da69 100644 --- a/src/mongo/s/transaction_router_test.cpp +++ b/src/mongo/s/transaction_router_test.cpp @@ -665,7 +665,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, CannotCommitWithoutParticipants) auto& txnRouter(*TransactionRouter::get(operationContext())); txnRouter.beginOrContinueTxn( - operationContext(), txnNum, TransactionRouter::TransactionActions::kStart); + operationContext(), txnNum, TransactionRouter::TransactionActions::kCommit); txnRouter.setDefaultAtClusterTime(operationContext()); ASSERT_THROWS(txnRouter.commitTransaction(operationContext(), boost::none), AssertionException); |