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

Make the DSS acquisition a RAII

    • Fully Compatible
    • Sharding EMEA 2022-09-19
    • 130

      Currently the DSS (database sharding state) service is protected by a ResourceMutex, which is owned by the DSS itself. This means it is not possible to lock it before a reference to that service is obtained or from outside. This prevents implementing dropping and the lock-free concurrency control scenarios where we require several services to be kept in sync.

      This ticket is to pull the locking of the DSS outside of the DSS object itself, so that it can be held locked for longer than the lifetime of the DSS. Furthermore, it will serve as an input to the "optimistic services snapshots" work later on, which needs to obtain a snapshot of everything about a collection in an atomic manner without holding locks.

      This lock must be acquired always at a level-0 or 1, meaning it must be the last lock acquired or the second to last, with the last being the CSS lock.

      It is either:

      • Only the DSS lock by itself
      • Only DSS lock + CSS lock
      • The db/collection locking hierarchy + DSS lock + CSS lock

            Assignee:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: