From 6a08c23ebeab0e0434226cbc6c690b458e61d745 Mon Sep 17 00:00:00 2001 From: Jason Zhang Date: Wed, 19 Jan 2022 21:14:45 +0000 Subject: SERVER-61085 Do not persist txnRetryCounter if value is default --- src/mongo/db/op_observer_impl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mongo/db/op_observer_impl.cpp') diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index 51bf478673f..40f7d2569bf 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -1350,7 +1350,7 @@ OpTimeBundle logApplyOpsForTransaction(OperationContext* opCtx, oplogEntry->setNss({"admin", "$cmd"}); oplogEntry->setSessionId(opCtx->getLogicalSessionId()); oplogEntry->setTxnNumber(opCtx->getTxnNumber()); - if (areInternalTransactionsEnabled) { + if (areInternalTransactionsEnabled && !isDefaultTxnRetryCounter(txnRetryCounter)) { oplogEntry->getOperationSessionInfo().setTxnRetryCounter(txnRetryCounter); } @@ -1364,7 +1364,7 @@ OpTimeBundle logApplyOpsForTransaction(OperationContext* opCtx, sessionTxnRecord.setLastWriteDate(times.wallClockTime); sessionTxnRecord.setState(txnState); sessionTxnRecord.setStartOpTime(startOpTime); - if (areInternalTransactionsEnabled) { + if (areInternalTransactionsEnabled && !isDefaultTxnRetryCounter(txnRetryCounter)) { sessionTxnRecord.setTxnRetryCounter(txnRetryCounter); } onWriteOpCompleted(opCtx, std::move(stmtIdsWritten), sessionTxnRecord); @@ -1591,7 +1591,7 @@ void logCommitOrAbortForPreparedTransaction(OperationContext* opCtx, oplogEntry->setNss({"admin", "$cmd"}); oplogEntry->setSessionId(opCtx->getLogicalSessionId()); oplogEntry->setTxnNumber(opCtx->getTxnNumber()); - if (areInternalTransactionsEnabled) { + if (areInternalTransactionsEnabled && !isDefaultTxnRetryCounter(txnRetryCounter)) { oplogEntry->getOperationSessionInfo().setTxnRetryCounter(txnRetryCounter); } oplogEntry->setPrevWriteOpTimeInTransaction( @@ -1619,7 +1619,7 @@ void logCommitOrAbortForPreparedTransaction(OperationContext* opCtx, sessionTxnRecord.setLastWriteOpTime(oplogOpTime); sessionTxnRecord.setLastWriteDate(oplogEntry->getWallClockTime()); sessionTxnRecord.setState(durableState); - if (areInternalTransactionsEnabled) { + if (areInternalTransactionsEnabled && !isDefaultTxnRetryCounter(txnRetryCounter)) { sessionTxnRecord.setTxnRetryCounter(txnRetryCounter); } onWriteOpCompleted(opCtx, {}, sessionTxnRecord); -- cgit v1.2.1