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

Make the CSS acquisition a RAII

    • Fully Compatible
    • Sharding EMEA 2022-09-19, Sharding EMEA 2022-10-03, Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31
    • 132

      Currently the CSS (collection sharding state) service is protected by a ResourceMutex, which is owned by the CSS 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 CSS outside of the CSS object itself, so that it can be held locked for longer than the lifetime of the CSS. 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, meaning it must be the last lock acquired.

      It is either:

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

            Assignee:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: