diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2022-01-19 21:14:45 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-19 22:19:43 +0000 |
commit | 6a08c23ebeab0e0434226cbc6c690b458e61d745 (patch) | |
tree | 02249a4a031dbbb2f16bb0de97f65082a1d66a87 /src/mongo/db/op_observer_impl.cpp | |
parent | 0073acf24096185e67c87318919354b4745cd538 (diff) | |
download | mongo-6a08c23ebeab0e0434226cbc6c690b458e61d745.tar.gz |
SERVER-61085 Do not persist txnRetryCounter if value is default
Diffstat (limited to 'src/mongo/db/op_observer_impl.cpp')
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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); |