[SERVER-39439] Add prepareTransaction oplog format Created: 08/Feb/19  Updated: 29/Oct/23  Resolved: 19/Feb/19

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.1.9

Type: Task Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Jason Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-39441 Write the new prepare command on primary Closed
Backwards Compatibility: Fully Compatible
Sprint: Repl 2019-02-25
Participants:

 Description   

On “prepare” command, an oplog entry is written for each operation in the transaction with the new root field

{ “inTxn” : true }

to denote it is a no-op. Then the primary follows the current “prepare” procedure: reserving an OpTime for Prepare Oplog Entry; preparing the WriteUnitOfWork; and writing down Prepare Oplog Entry, with the reserved OpTime. However, the format of Prepare Oplog Entry will include a new “prepareTransaction” command as its “o” root field rather than an “applyOps” command.

{
    "ts": Timestamp(1538534640, 10),
    "t": NumberLong(1),
    "op": "c",
    "ns": "admin.$cmd",
 
    // The new prepare command.
    "o": { "prepareTransaction": 1 },
 
    "lsid": < lsid > ,
    "txnNumber": NumberLong("1"),
    // Pointing to the previous operation in the transaction.
    // Assuming there exists an operation at this OpTime for this transaction.
    "prevOpTime": { "ts": Timestamp(1538534630, 2), "t": NumberLong(1) }
}



 Comments   
Comment by Githook User [ 19/Feb/19 ]

Author:

{'name': 'Jason Chan', 'email': 'jason.chan@10gen.com'}

Message: SERVER-39439 Add prepareTransaction oplog format
Branch: master
https://github.com/mongodb/mongo/commit/826db225ff74e5d74f9fe03a0f31c5dd63fc5b17

Generated at Thu Feb 08 04:52:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.