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

Writing transaction oplog entries must not take locks while holding an oplog slot

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.11
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2019-04-22, Repl 2019-05-06, Repl 2019-05-20
    • 30

      It is illegal to acquire new locks while holding open an oplog slot, since it can cause the deadlock described inĀ SERVER-35367. We do this in a few places when writing transaction oplog entries:

      When preparing a transaction, we reserve oplog slots here or here, then stash the locker here or here, then take a global lock here or here.

      When aborting a prepared transaction, we reserve an oplog slot here, then release locksĀ here, then take a global lock here.

      When committing a prepared transaction, we reserve an oplog slot here, then release locks here, then take a global lock here.

      (Note that the global lock acquisition for writing oplog entries for unprepared transaction commit is not a problem, since the locker is already holding the global lock.)

            Assignee:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: