From f17ad42fb53a2b5ae224006fa8f36c531e6f0b04 Mon Sep 17 00:00:00 2001 From: Esha Maharishi Date: Fri, 31 May 2019 03:17:13 -0400 Subject: SERVER-41417 Transaction coordinator should only delete durable state if two-phase commit completed successfully --- src/mongo/db/s/transaction_coordinator.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/mongo/db/s/transaction_coordinator.cpp b/src/mongo/db/s/transaction_coordinator.cpp index e48938568c0..3b85046b626 100644 --- a/src/mongo/db/s/transaction_coordinator.cpp +++ b/src/mongo/db/s/transaction_coordinator.cpp @@ -186,19 +186,10 @@ TransactionCoordinator::TransactionCoordinator(ServiceContext* serviceContext, MONGO_UNREACHABLE; }; }) - .onCompletion([this](Status s) { - // Do a best-effort attempt to delete the coordinator document from disk, regardless of - // the success of the commit sequence. - LOG(3) << "Two-phase commit completed for " << _lsid.getId() << ':' << _txnNumber; - - return txn::deleteCoordinatorDoc(*_scheduler, _lsid, _txnNumber) - .onCompletion([ this, chainStatus = std::move(s) ](Status deleteDocStatus) { - if (_participantsDurable) { - LOG(0) << redact(deleteDocStatus); - } - - return chainStatus; - }); + .then([this] { + // Do a best-effort attempt (i.e., writeConcern w:1) to delete the coordinator's durable + // state. + return txn::deleteCoordinatorDoc(*_scheduler, _lsid, _txnNumber); }) .onCompletion([ this, deadlineFuture = std::move(deadlineFuture) ](Status s) mutable { // Interrupt this coordinator's scheduler hierarchy and join the deadline task's future -- cgit v1.2.1