diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-05-31 03:17:13 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-06-04 13:55:51 -0400 |
commit | f17ad42fb53a2b5ae224006fa8f36c531e6f0b04 (patch) | |
tree | 10cb6b2a97b683be67e720da7032b1cb0f73c6a5 | |
parent | 960e89726fd59e2d70ef9239d11fd907616279f3 (diff) | |
download | mongo-f17ad42fb53a2b5ae224006fa8f36c531e6f0b04.tar.gz |
SERVER-41417 Transaction coordinator should only delete durable state if two-phase commit completed successfullyr4.2.0-rc0
-rw-r--r-- | src/mongo/db/s/transaction_coordinator.cpp | 17 |
1 files 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 |