summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/repl/transaction_oplog_application.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/repl/transaction_oplog_application.cpp b/src/mongo/db/repl/transaction_oplog_application.cpp
index 8a280a9d71a..8090164d85e 100644
--- a/src/mongo/db/repl/transaction_oplog_application.cpp
+++ b/src/mongo/db/repl/transaction_oplog_application.cpp
@@ -430,6 +430,10 @@ Status _applyPrepareTransaction(OperationContext* opCtx,
auto txnParticipant = TransactionParticipant::get(opCtx);
+ // We reset the recovery unit on retries, so make sure that we ignore prepare conflicts.
+ opCtx->recoveryUnit()->setPrepareConflictBehavior(
+ PrepareConflictBehavior::kIgnoreConflictsAllowWrites);
+
// Release the WUOW, transaction lock resources and abort storage transaction so that the
// writeConflictRetry loop will be able to retry applying transactional ops on WCE error.
auto abortOnError = makeGuard([&txnParticipant, opCtx] {