ExportXMLWordPrintableJSON

    • Minor Change
    • QI 2025-02-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Change streams synthesized an endOfTransaction event only for unprepared multi-document transactions, whose commit is the final applyOps entry.
      A prepared replica-set/single-shard transaction commits through a standalone commitTransaction oplog entry instead, so it currently produces no event.
      This change teaches the replica-set/single-shard unwind stage that commit shape and records on the commit entry that the write path for end-of-transaction was enabled at transaction commit time.

      This makes replica-set/single-shard transactions write additional metadata into the oplog for prepared replica-set/single-shard transactions if the end-of-transaction write path is enabled (featureFlagEndOfTransactionChangeEventSynthesis and the allowEndOfTransaction server parameter are both enabled). In this case, the commitTransaction oplog entry is stamped with

      o2: { allowEndOfTransaction: true }
      

      The new flag goes on the entry's o2, not o. The reason for this is that commitTransaction.o is parsed strictly, so a 9.0 binary (which does not declare the field) would reject such entry. o2 is a generic, already-declared oplog field that older binaries tolerate, which keeps the write multiversion-safe.
      The o field of commitTransaction remains unchanged.

      The change stream read side (ChangeStreamUnwindTransactionStage) now considers a commitTransaction entry as an additional candidate for emitting endOfTransaction events.

      Anything in this description will be included in the commit message. Replace or delete this text
      before merging. Add links to testing in the comments of the PR.

            Assignee:
            Jan Steemann
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: