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

Data race while setting index build interceptor on empty coll optimization path

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • Execution Team 2023-05-29

      The interceptor is set to null in an onCommit hook after the catalog write is finished, while holding the collection MODE_IX lock (implicit collection creation). This used to be fine before the PIT catalog lookups, as the collection catalog is updated as the last onCommit hook handler. 

      After the PIT catalog project, once a collection is persisted in WT, a new catalog reader can create a Collection instance from WT and then take the shared state from a newer already existing collection (code).

      SERVER-65006 added the onCommit hook to prevent the interceptor from being removed when the commit fails due to write conflict error, which would be retried without the interceptor.

      Part of the issue is that index build code does not follow the usual pattern of acquiring locks and catalog inside the write conflict retry loop. In that case all state would be discarded on write conflict, including the interceptor being removed, and a fresh copy of the catalog taken to retry the operation.

            Assignee:
            yujin.kang@mongodb.com Yujin Kang Park
            Reporter:
            yujin.kang@mongodb.com Yujin Kang Park
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: