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

OpObserverImpl::onTransactionPrepare() reserves OplogSlots rather than using the one reserved by its caller

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • Repl 2019-05-06, Repl 2019-05-20

      Large transactions will pack multiple operations into a single applyOps. The caller of OpObserver::onTransactionPrepare() won't know how many oplog slots are needed in advance. To avoid the bug in SERVER-35798, we still need to reserve an oplog slot in TransactionParticipant to prevent advancing lastApplied and prevent secondaries to read the prepare oplog entry before the transaction is actually prepared. OpObserverImpl can reserve and use its own OplogSlots to write packed oplog entries in side transactions. The prepare timestamp can be set by OpObserver or by TransactionParticipant with the getLastOp() on ReplClientInfo.

      An alternative solution is to reserve more oplog slots than needed, e.g. one for each operations, but the first proposal imposes less restrictions on the caller and simplifies the OpObserver interface.

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

              Created:
              Updated:
              Resolved: