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

RecordStore RecordId initialization can deadlock transactions with cache eviction

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0, 5.2.1, 5.0.7
    • Affects Version/s: 5.2.0, 5.1.2, 5.0.6
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • v5.2, v5.0, v4.4
    • Execution Team 2022-02-07, Execution Team 2022-02-21
    • 155

      There is a bug with our RecordId initialization that is more generally described by SERVER-61116. As a consequence, very large multi-document transactions that consume most of cache can deadlock. In practice, this has to be the first transaction to write to a given collection.

      We create a new WT_SESSION to call largest_key() to lazily initialize the highest RecordId for a collection (as of SERVER-58409). We can do this while holding hostage another session that is pinning a large amount of data in the cache. If this large transaction is pinning enough data, then the largest_key() call can block, but the session pinning that content cannot be rolled-back because it is held by the same thread.

      We should use an "operation_timeout_ms" here, as we did in SERVER-61097. This will cause the operation to receive a WT_ROLLBACK after a period of time, which we should throw back to the parent operation to retry.

            louis.williams@mongodb.com Louis Williams
            louis.williams@mongodb.com Louis Williams
            0 Vote for this issue
            4 Start watching this issue