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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.11
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Repl 2019-04-22, Repl 2019-05-06, Repl 2019-05-20
    • Linked BF Score:
      30

      Description

      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.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              siyuan.zhou Siyuan Zhou
              Reporter:
              tess.avitabile Tess Avitabile
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: