diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-12-19 16:36:28 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-12-22 09:11:43 -0500 |
commit | b30c434c313dde1ded0bc0d73d264d27b1eafaa6 (patch) | |
tree | 9e356a7c465931dacca25e9da58db349c24dd344 /src/mongo/db/transaction_participant.h | |
parent | 22d19f03b6ce14b9bc4cacd8c15faa1fa5f15ff2 (diff) | |
download | mongo-b30c434c313dde1ded0bc0d73d264d27b1eafaa6.tar.gz |
SERVER-38713 Get rid of transaction number equality checking from _makeUpdateRequest/_registerUpdateCacheOnCommit
Diffstat (limited to 'src/mongo/db/transaction_participant.h')
-rw-r--r-- | src/mongo/db/transaction_participant.h | 16 |
1 files changed, 6 insertions, 10 deletions
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<repl::OpTime> _checkStatementExecuted(StmtId stmtId) const; - UpdateRequest _makeUpdateRequest(WithLock, - TxnNumber newTxnNumber, - const repl::OpTime& newLastWriteOpTime, + UpdateRequest _makeUpdateRequest(const repl::OpTime& newLastWriteOpTime, Date_t newLastWriteDate, boost::optional<DurableTxnStateEnum> newState) const; - void _registerUpdateCacheOnCommit(OperationContext* opCtx, - TxnNumber newTxnNumber, - std::vector<StmtId> stmtIdsWritten, + void _registerUpdateCacheOnCommit(std::vector<StmtId> 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<SessionTxnRecord> _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. |