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

Periodically wake up when waiting for prepare conflicts

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL
    • 10

      When MongoDB encounters a prepare conflict in WiredTiger, we wait until an active MongoDB WriteUnitOfWork commits or aborts.

      There is a deadlock caused by this approach that can be described as follows:

      • A prepared transaction has updated a document.
      • A concurrent operation tries to read that document, but it hits a prepare conflict. It waits until the prepared transactions commits or aborts (via a notification). While it waits, its cursor remains positioned, preventing the page from being evicted.
      • The prepared transaction aborts or commits, but after the transition rolls-back, it is recruited for bonus eviction. It cannot evict anything because the page is pinned by the reader. So even though the transaction has been successfully rolled back in the storage engine, cannot make progress to signal the reader to continue. The reader is waiting for a notification, which would unpin the page.

      This is only a bug in a system with one prepared transaction, since any transactions committing or aborting would wake the reader.

      To break this cycle, we could add a periodic wakeup when waiting for prepared transactions to commit or abort. Something like 100ms. This would allow the reader to make progress and unpin the problematic page.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: