-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Sharding EMEA
-
Fully Compatible
-
Execution Team 2022-12-26, Execution Team 2023-01-09
SERVER-69435 introduces a method that acquires the CollectionShardingRuntime with a given lock mode (shared or exclusive). It sometimes may not be clear which lock mode should be used to do a particular action on the CSR. This could lead to the introduction of bugs in the future.
We should make the type of lock required be enforced by the API. One idea is to have two acquisition methods:
- One that takes the exclusive lock and returns a non-const CSR.
- The other takes the shared lock and returns a const CSR.
All methods that modify the CSR (i.e. need exclusive lock) should be made non-const. All methods that do not modify the CSR should be made const.