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

Write change stream pre-images in the main storage engine transaction before the transaction reaches Prepared state

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QE 2022-04-04, QE 2022-02-21, QE 2022-03-07, QE 2022-03-21

      For write operations in a mongodb transaction it is desirable to write change stream pre-images in the main storage engine transaction before the storage engine transaction reaches the Prepared state as opposed to writing the pre-images in a storage engine transaction that commits oplog entry(-ies) indicating that the transaction prepared.
      If the pre-images are not written in the main transaction as described above, when a prepared transaction is aborted, the pre-images associated with operations of that transaction get written on the primary node, but not on the secondaries. This happens because when the oplog is applied on the secondaries, the aborted transactions essentially don’t trigger any action on the secondaries. The expired pre-image deletion process ultimately gets rid of these documents. However, inconsistent pre-image state between the primary and secondary nodes is not ideal and can delay deletion of pre-images associated with prepared and later aborted transactions.

      Explore the options of achieving this improvement and implement the best one if feasible. 

            Assignee:
            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas
            Reporter:
            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: