diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2019-04-02 10:05:20 -0400 |
---|---|---|
committer | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2019-04-02 10:05:20 -0400 |
commit | c845caf2d6fa909e372e2e178fca7d0640924fe1 (patch) | |
tree | 4e602a29db9ab9688ff970c66363000eb8bb1a27 /src/mongo/db/transaction_participant.cpp | |
parent | 0778cb69487d7d223f71d5dff7ec754edb33a7eb (diff) | |
download | mongo-c845caf2d6fa909e372e2e178fca7d0640924fe1.tar.gz |
SERVER-39690: Fix prepared transaction metrics after exceptions in prepare
- Also added unit test
Diffstat (limited to 'src/mongo/db/transaction_participant.cpp')
-rw-r--r-- | src/mongo/db/transaction_participant.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp index 59ec112a210..06794e680c2 100644 --- a/src/mongo/db/transaction_participant.cpp +++ b/src/mongo/db/transaction_participant.cpp @@ -1289,15 +1289,13 @@ void TransactionParticipant::Participant::_finishCommitTransaction(OperationCont { auto tickSource = opCtx->getServiceContext()->getTickSource(); - const bool isCommittingWithPrepare = o().txnState.isCommittingWithPrepare(); stdx::lock_guard<Client> lk(*opCtx->getClient()); o(lk).txnState.transitionTo(TransactionState::kCommitted); o(lk).transactionMetricsObserver.onCommit(ServerTransactionsMetrics::get(opCtx), tickSource, p().oldestOplogEntryOpTime, - &Top::get(getGlobalServiceContext()), - isCommittingWithPrepare); + &Top::get(getGlobalServiceContext())); o(lk).transactionMetricsObserver.onTransactionOperation( opCtx, CurOp::get(opCtx)->debug().additiveMetrics, o().txnState.isPrepared()); } @@ -1443,8 +1441,7 @@ void TransactionParticipant::Participant::_abortTransactionOnSession(OperationCo ServerTransactionsMetrics::get(opCtx->getServiceContext()), tickSource, p().oldestOplogEntryOpTime, - &Top::get(opCtx->getServiceContext()), - o().txnState.isPrepared()); + &Top::get(opCtx->getServiceContext())); } if (o().txnResourceStash) { |