-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.1.6
-
Component/s: Replication
-
None
-
Fully Compatible
-
Sharding 2019-01-28, Sharding 2019-02-11
Problem Summary
We would like to be able to observe all statements on transaction commit. This is so that migrations may take these statements on commit and add them to any current transferMods queue.
Currently, for prepared transactions, we discard statements on prepare, and don't persist these statements until commit time.
Proposed Approach
We will have to make changes to the transaction participant in order to persist these statements.
- A new method retrieveOperations() will simply retrieve and return a reference to _transactionOperations. This method will require that the session is checked out, and that it is only called after the transaction has been prepared.
- A new method endTransactionAndClearOperationsInMemory() will clear the _transactionOperations variable and set _transactionOperationBytes to zero.
- The current usage of the method endTransactionAndRetrieveOperations() will be replaced with retrieveOperations() when we want the operations, combined with endTransactionAndClearOperationsInMemory() when we want to clear the transaction memory on commit.
- Prepared transactions will no longer call endTransactionAndRetrieveOperations() on prepare. They will call both retrieveOperations() and endTransactionAndClearOperationsInMemory() on commit.
- Non-prepared transactions will continue to persist the previous behavior of the previous method, calling both retrieveOperationsFor() and endTransactionAndClearOperationsInMemory() on commit.
NOTE: We have renamed retrieveOperationsForMigrate() to retrieveOperations(), because we have identified usage of said operations outside of migrate, including here.
- is depended on by
-
SERVER-38284 Remove donor collection X-lock acquisition for starting the clone phase
- Closed
-
SERVER-39021 Switch migrations to observe multi-statement transaction CRUD statements onCommit instead of onCRUD
- Closed
- related to
-
SERVER-69478 remove unnecessary copy in TransactionParticipant::commitUnpreparedTransaction()
- Closed
-
SERVER-69560 change return type of TransactionParticipant::retrieveCompletedOperations() to a pointer
- Closed