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

Fix lock ordering in TextMatchExpression

    • Query Integration
    • Fully Compatible
    • ALL
    • v8.0

      The TextMatchExpression object currently attempts to acquire a collection manually in order to gather the necessary information. This has the requirement of locking the collection and following the lock hierarchy.

      However, this has the unfortunate side effect of flipping the lock ordering used for the global and RSTL locks in case we're doing a lock-free read. The lock-free read only locks the global lock while the class would then proceed to lock the RSTL first followed by the global lock. That is, it breaks the ordering of first RSTL followed by Global locks.

      This has the potential to cause a deadlock even if we haven't yet encountered it.

      The ideal fix here would be to just replace that call with something that uses the Shard Role API so we acquire the collection in the same manner as the rest of the code path.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            jordi.olivares-provencio@mongodb.com Jordi Olivares Provencio
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: