[SERVER-69434] Make the DSS acquisition a RAII Created: 05/Sep/22  Updated: 29/Oct/23  Resolved: 12/Sep/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Kaloian Manassiev
Resolution: Fixed Votes: 0
Labels: PM-2144-Milestone-0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-69444 Make the joining of concurrent critic... Closed
is depended on by SERVER-69435 Make the CSS acquisition a RAII Closed
is depended on by SERVER-69445 Implement the CollectionSnapshot(s) i... Closed
Problem/Incident
causes SERVER-70154 DatabaseShardingState inappropriately... Closed
Related
is related to SERVER-70198 Use one single RESOURCE_MUTEX to prot... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2022-09-19
Participants:
Linked BF Score: 130

 Description   

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


 Comments   
Comment by Githook User [ 11/Sep/22 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-69434 Make the DSS acquisition a RAII
Branch: master
https://github.com/mongodb/mongo/commit/a383a136ee3c8c71fc0a7d8ccbb64fa6dcee7c90

Generated at Thu Feb 08 06:13:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.