diff options
author | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2019-02-27 19:06:48 -0500 |
---|---|---|
committer | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2019-02-27 19:06:48 -0500 |
commit | a74b2f39025fee2c59aa5437deea6e06f05e18ca (patch) | |
tree | 7de800c90cf8080e2029a1cb7a1bf47674ed996b /src/mongo/db/transaction_participant.cpp | |
parent | 2f45a9e8e858c6e3fe2c5104e849b423bf691a3c (diff) | |
download | mongo-a74b2f39025fee2c59aa5437deea6e06f05e18ca.tar.gz |
Revert "SERVER-39139 Disallow starting transactions on secondaries"
This reverts commit 58fad7d7efa275beb4a6a83f90d3dd222bbb534b.
Diffstat (limited to 'src/mongo/db/transaction_participant.cpp')
-rw-r--r-- | src/mongo/db/transaction_participant.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp index 2a7e6817328..2d3127323b8 100644 --- a/src/mongo/db/transaction_participant.cpp +++ b/src/mongo/db/transaction_participant.cpp @@ -446,17 +446,6 @@ void TransactionParticipant::Participant::beginOrContinue(OperationContext* opCt TxnNumber txnNumber, boost::optional<bool> autocommit, boost::optional<bool> startTransaction) { - // Make sure we are still a primary. We need to hold on to the RSTL through the end of this - // method, as we otherwise risk stepping down in the interim and incorrectly updating the - // transaction number, which can abort active transactions. - Lock::ResourceLock rstl(opCtx->lockState(), resourceIdReplicationStateTransitionLock, MODE_IX); - if (opCtx->writesAreReplicated()) { - auto replCoord = repl::ReplicationCoordinator::get(opCtx); - uassert(ErrorCodes::NotMaster, - "Not primary so we cannot begin or continue a transaction", - replCoord->canAcceptWritesForDatabase(opCtx, "admin")); - } - uassert(ErrorCodes::TransactionTooOld, str::stream() << "Cannot start transaction " << txnNumber << " on session " << _sessionId() |