Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-39439

Add prepareTransaction oplog format

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • Repl 2019-02-25

      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) }
      }
      

            Assignee:
            jason.chan@mongodb.com Jason Chan
            Reporter:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: