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

Preserve donor oplog optime in o2 when avoid re-wrapping previously migrated retryable writes noop

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.0-rc1, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • v5.0
    • Repl 2021-05-31

      We had logic to avoid re-wrapping previously migrated retryable writes noop in new noops. For example, if the previously migrated retryable writes noop the recipient fetches from the donor looks like {op: 'n', o2: <original_retryable_write_entry with ts 50>, ts: 100, ...}, the new noop the recipient writes would look like {op: 'n', o2: <original_retryable_write_entry with ts 50>, ts: xxx, ...} (where xxx is the timestamp at which the recipient writes the new noop).

      After failovers, the recipient uses the ts in the o2 field of the last noop to determine where to resume applying/batching donor oplog entries.

      Using the example above, if the recipient has processed a donor oplog at ts: 100, we should resume applying/batching from ts: 100. But because this doesn't preserve the processed donor optime in o2, the recipient would mistakenly resume from ts: 50 after failovers, which could result in processing the same retryable write twice or having two entries of the same statement in the oplog chain.

            Assignee:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Reporter:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: