Simplify locking requirements for MigrationSourceManager::_cloneDriver

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2025-03-03, CAR Team 2025-03-17, CAR Team 2025-03-31
    • 0
    • 1
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The comment for MigrationSourceManager::_cloneDriver requires holding a collection lock, the CSR lock and the _mutex to modify it, and just the _mutex to read it. In reality we don't rely on the _mutex at all, because we access it without holding the _mutex:

      • Here we are unsetting it.
      • Here we are reading it.
        In both cases there's no race condition thanks to the CSR lock.

      Furthermore we don't need the collection lock, since it's not providing any synchronization. The synchronization between op_observers (e.g. for inserts) and the cloner initialization happens through the wait for readConcern just after the initialization, which guarantees all new writes will see the cloner.

      We should simplify the locking around this field.

            Assignee:
            Daniel Gomez Ferro
            Reporter:
            Daniel Gomez Ferro
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: