summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2019-05-24 11:39:51 -0400
committerMatthew Russotto <matthew.russotto@10gen.com>2019-06-06 10:09:53 -0400
commitc7f1e4270b8dcbc09e6b2952671c70f5274401de (patch)
tree68e959d8360a382f228c9bdef30ff693f09e1601 /src
parentb1a57f73a3b3bdc8e1b088838aa04a475115dd96 (diff)
downloadmongo-c7f1e4270b8dcbc09e6b2952671c70f5274401de.tar.gz
SERVER-41306 In FCV 4.0, don't treat transactions as retryable writes
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/transaction_participant.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp
index 54a0d8ff725..96512354255 100644
--- a/src/mongo/db/transaction_participant.cpp
+++ b/src/mongo/db/transaction_participant.cpp
@@ -159,16 +159,6 @@ ActiveTransactionHistory fetchActiveTransactionHistory(OperationContext* opCtx,
continue;
}
- const auto insertRes =
- result.committedStatements.emplace(*entry.getStatementId(), entry.getOpTime());
- if (!insertRes.second) {
- const auto& existingOpTime = insertRes.first->second;
- fassertOnRepeatedExecution(lsid,
- result.lastTxnRecord->getTxnNum(),
- *entry.getStatementId(),
- existingOpTime,
- entry.getOpTime());
- }
// State is a new field in FCV 4.2, so look for an applyOps oplog entry without a
// prepare flag to mark a committed transaction in FCV 4.0 or downgrading to 4.0. Check
@@ -179,6 +169,18 @@ ActiveTransactionHistory fetchActiveTransactionHistory(OperationContext* opCtx,
(entry.getCommandType() == repl::OplogEntry::CommandType::kApplyOps &&
!entry.shouldPrepare() && !entry.isPartialTransaction())) {
result.lastTxnRecord->setState(DurableTxnStateEnum::kCommitted);
+ return result;
+ }
+
+ const auto insertRes =
+ result.committedStatements.emplace(*entry.getStatementId(), entry.getOpTime());
+ if (!insertRes.second) {
+ const auto& existingOpTime = insertRes.first->second;
+ fassertOnRepeatedExecution(lsid,
+ result.lastTxnRecord->getTxnNum(),
+ *entry.getStatementId(),
+ existingOpTime,
+ entry.getOpTime());
}
} catch (const DBException& ex) {
if (ex.code() == ErrorCodes::IncompleteTransactionHistory) {