diff options
author | Pavi Vetriselvan <pvselvan@umich.edu> | 2019-04-02 10:41:27 -0400 |
---|---|---|
committer | Pavi Vetriselvan <pvselvan@umich.edu> | 2019-04-02 10:44:20 -0400 |
commit | e8f8a1bf5f4a9dea142e93d82639d96073fc09a5 (patch) | |
tree | a529df2775c9579f9abfd7e064b8b720dbcaed70 /src/mongo/db | |
parent | 5661c7cb174ccd776c994141f30f625a976aa444 (diff) | |
download | mongo-e8f8a1bf5f4a9dea142e93d82639d96073fc09a5.tar.gz |
SERVER-39042 Coordinator does not add one to commitTimestamp
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/s/transaction_coordinator.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/mongo/db/s/transaction_coordinator.cpp b/src/mongo/db/s/transaction_coordinator.cpp index 65b1231fe66..98df3191e08 100644 --- a/src/mongo/db/s/transaction_coordinator.cpp +++ b/src/mongo/db/s/transaction_coordinator.cpp @@ -44,26 +44,6 @@ using CoordinatorCommitDecision = txn::CoordinatorCommitDecision; using PrepareVoteConsensus = txn::PrepareVoteConsensus; using TransactionCoordinatorDocument = txn::TransactionCoordinatorDocument; -CoordinatorCommitDecision makeDecisionFromPrepareVoteConsensus(ServiceContext* service, - const PrepareVoteConsensus& result, - const LogicalSessionId& lsid, - TxnNumber txnNumber) { - auto decision = result.decision(); - - if (decision.getDecision() == CommitDecision::kCommit) { - LOG(3) << "Advancing cluster time to the commit timestamp " - << *decision.getCommitTimestamp() << " for " << lsid.getId() << ':' << txnNumber; - - uassertStatusOK(LogicalClock::get(service)->advanceClusterTime( - LogicalTime(*decision.getCommitTimestamp()))); - - decision.setCommitTimestamp(Timestamp(decision.getCommitTimestamp()->getSecs(), - decision.getCommitTimestamp()->getInc() + 1)); - } - - return decision; -} - } // namespace TransactionCoordinator::TransactionCoordinator(ServiceContext* serviceContext, @@ -191,8 +171,16 @@ Future<CoordinatorCommitDecision> TransactionCoordinator::_runPhaseOne( .then([this, participantShards](PrepareVoteConsensus result) { invariant(_state == CoordinatorState::kPreparing); - auto decision = - makeDecisionFromPrepareVoteConsensus(_serviceContext, result, _lsid, _txnNumber); + auto decision = result.decision(); + if (decision.getDecision() == CommitDecision::kCommit) { + LOG(3) << "Advancing cluster time to the commit timestamp " + << *decision.getCommitTimestamp() << " for " << _lsid.getId() << ':' + << _txnNumber; + + uassertStatusOK( + LogicalClock::get(_serviceContext) + ->advanceClusterTime(LogicalTime(*decision.getCommitTimestamp()))); + } return txn::persistDecision(*_scheduler, _lsid, |