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

Use one single RESOURCE_MUTEX to protect concurrent operations on DatabaseShardingState for all databases

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31

      SERVER-69434 changed DatabaseShardingState to protect concurrent access to it by using a LockManager RESOURCE_MUTEX with ResourceId(RESOURCE_MUTEX, dbName). However, constructing ResourceIds outside ResourceIdFactory is not correct and causes bugs like SERVER-70154. SERVER-69893 proposed a new LockManager lock type to work around this limitation, but agreement has been reached in favor of avoiding the introduction new lock types to the LockManager.

      The proposed alternative is to use one single RESOURCE_MUTEX to protect access to all DatabaseShardingStates – for all databases in the system. The rationale is that:

      • No blocking work is ever done under the this lock (only read in memory structures under IS, and update memory structures under X),
      • X mode acquisitions are very rare.

            Assignee:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: