[SERVER-69435] Make the CSS acquisition a RAII Created: 05/Sep/22  Updated: 29/Oct/23  Resolved: 26/Oct/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: Jordi Serra Torrens
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-69434 Make the DSS acquisition a RAII Closed
depends on SERVER-69893 Add the ability to acquire lock manag... Closed
is depended on by SERVER-69445 Implement the CollectionSnapshot(s) i... Closed
Problem/Incident
causes SERVER-76652 createRandomCursorExecutor holds the ... Closed
causes SERVER-71010 Initialize CollectionShardingStateFac... Closed
causes SERVER-71081 Make ShardingWriteRouter instantiatio... Closed
Related
Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2022-09-19, Sharding EMEA 2022-10-03, Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31
Participants:
Linked BF Score: 132

 Description   

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


 Comments   
Comment by Githook User [ 26/Oct/22 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-69435 Make the CSS acquisition a RAII
Branch: master
https://github.com/mongodb/mongo/commit/1ddc20571ad31d622045d80049c4e7879a780a14

Comment by Githook User [ 21/Sep/22 ]

Author:

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

Message: SERVER-69435 Cleanup includes and libraries

General cleanup in preparation for the larger incoming change
Branch: master
https://github.com/mongodb/mongo/commit/5274f1afdb125e6415d13892d6f8a58a8dba66a3

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