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

Avoid applying commitTransaction entry individually if it refers to a prepare entry in the same batch

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      With the current design, when the oplog batcher decides a commitTransaction oplog entry needs to be applied individually (OplogBatcher::mustProcessIndividually), it will check if the commitTransaction entry refers to a session in the SplitPrepareSessionManager, and will process it individually if not. However if the commitTransaction entry and the prepare entry it refers to come from the same batch, this check will always fail since we have yet called SplitPrepareSessionManager to split the session at this point.

      This results in us unnecessarily apply certain commitTransaction entries in their own batch, although it's not very common to have the commitTransaction entry and the prepare entry it refers to coming from the same batch because the prepare must be majority committed before the commit command is run.

      To avoid this, the oplog batcher needs save some state (either setting in itself or in SplitPrepareSessionManager) when it sees a prepare entry to indicate that there is a prepare to be split, and later when it sees a following commitTransaction entry in the same batch, it knows that it refers to a to-be-split prepare and that we can put it in the same batch with the prepare entry.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            wenbin.zhu@mongodb.com Wenbin Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: