From b30c434c313dde1ded0bc0d73d264d27b1eafaa6 Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Wed, 19 Dec 2018 16:36:28 -0500 Subject: SERVER-38713 Get rid of transaction number equality checking from _makeUpdateRequest/_registerUpdateCacheOnCommit --- src/mongo/db/transaction_participant.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/mongo/db/transaction_participant.h') diff --git a/src/mongo/db/transaction_participant.h b/src/mongo/db/transaction_participant.h index 234e27f2b44..b8ac97b7e5f 100644 --- a/src/mongo/db/transaction_participant.h +++ b/src/mongo/db/transaction_participant.h @@ -395,7 +395,7 @@ public: * * Throws if the session has been invalidated or the active transaction number doesn't match. */ - repl::OpTime getLastWriteOpTime(TxnNumber txnNumber) const; + repl::OpTime getLastWriteOpTime() const; /** * Returns the prepare op time that was selected for the transaction, which can be Null if the @@ -644,15 +644,11 @@ private: boost::optional _checkStatementExecuted(StmtId stmtId) const; - UpdateRequest _makeUpdateRequest(WithLock, - TxnNumber newTxnNumber, - const repl::OpTime& newLastWriteOpTime, + UpdateRequest _makeUpdateRequest(const repl::OpTime& newLastWriteOpTime, Date_t newLastWriteDate, boost::optional newState) const; - void _registerUpdateCacheOnCommit(OperationContext* opCtx, - TxnNumber newTxnNumber, - std::vector stmtIdsWritten, + void _registerUpdateCacheOnCommit(std::vector stmtIdsWritten, const repl::OpTime& lastStmtIdWriteTs); // Called for speculative transactions to fix the optime of the snapshot to read from. @@ -772,6 +768,9 @@ private: // means a new transaction has begun on the session, but it hasn't yet performed any writes. TxnNumber _activeTxnNumber{kUninitializedTxnNumber}; + // Caches what is known to be the last optime written for the active transaction. + repl::OpTime _lastWriteOpTime; + // Set when a snapshot read / transaction begins. Alleviates cache pressure by limiting how long // a snapshot will remain open and available. Checked in combination with _txnState to determine // whether the transaction should be aborted. @@ -827,9 +826,6 @@ private: // truncated because it was too old. bool _hasIncompleteHistory{false}; - // Caches what is known to be the last written transaction record for the session - boost::optional _lastWrittenSessionRecord; - // For the active txn, tracks which statement ids have been committed and at which oplog // opTime. Used for fast retryability check and retrieving the previous write's data without // having to scan through the oplog. -- cgit v1.2.1