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

Investigate canonical ordering of locks during yield/restore

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing

      As part of SERVER-99150 we've implemented a lock ordering conflict detector.

      During yields we save and restore the lock state, this poses a particular problem for operations that hold multiple acquisitions/autogetters on different databases. This is because the locks taken due to the hierarchy for the databases may be in any ordering during a restore.

      Take the following example:

      • We acquire collA on dbA
      • We acquire collB on dbB.

      At this point the lock ordering followed is dbA -> collA -> dbB -> collB.

      However, during a yield the following lock ordering can take place when we restore if the resourceId of dbA is < dbB:

      • Lock dbA
      • Lock dbB
      • Lock collA
      • Lock collB

      Today this isn't a problem since we have no operations that yield and restore with multiple databases as aggregations hold their locks internally and thus aren't susceptible to normal yields. We should still however, consider how we can tackle this ordering issue during yields.

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

              Created:
              Updated: