[SERVER-70198] Use one single RESOURCE_MUTEX to protect concurrent operations on DatabaseShardingState for all databases Created: 04/Oct/22  Updated: 17/Oct/22  Resolved: 17/Oct/22

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

Type: Task Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Jordi Serra Torrens
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-70154 DatabaseShardingState inappropriately... Closed
Related
related to SERVER-69434 Make the DSS acquisition a RAII Closed
related to SERVER-69893 Add the ability to acquire lock manag... Closed
Sprint: Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31
Participants:

 Description   

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.


 Comments   
Comment by Jordi Serra Torrens [ 17/Oct/22 ]

Won't do. Instead we'll do SERVER-70610

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