[SERVER-38473] Replace uses of UninterruptibleLockGuard and MODE_X collection locks with uses of a database sharding state mutex for movePrimary functions Created: 07/Dec/18 Updated: 29/Oct/23 Resolved: 05/Feb/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.8 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Siyuan Zhou | Assignee: | Blake Oler |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | prepare_interruptibility, uninterruptibleLockGuardRemoval | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | Sharding 2019-01-14, Sharding 2019-01-28, Sharding 2019-02-11 | ||||||||
| Participants: | |||||||||
| Description |
|
We use UninterruptibleLockGuard in several places for movePrimaries. Since they acquire strong locks on normal databases and collections, they will be blocked by prepared transactions, causing deadlock on stepdown or shutdown. Here's a list of all the occurrences of UninterruptibleLockGuard for movePrimaries.
We will employ a new DatabaseShardingStateLock (similar to the CollectionShardingRuntimeLock) to safeguard concurrent access to the database critical section. When leaving critical section no longer conflicts with prepared transactions, they can run after prepared transactions yield locks on stepdown or being killed on shutdown. See The following function signature changes will allow us to relax the database locking to IX instead of X under the above UninterruptibleLockGuards. Database locks highlighted in bold will have a proposed change. All other database locks remain unchanged.
These situations can use relaxed locking as a result:
|
| Comments |
| Comment by Githook User [ 05/Feb/19 ] |
|
Author: {'name': 'Blake Oler', 'email': 'blake.oler@mongodb.com', 'username': 'BlakeIsBlake'}Message: |
| Comment by Githook User [ 05/Feb/19 ] |
|
Author: {'name': 'Blake Oler', 'email': 'blake.oler@mongodb.com', 'username': 'BlakeIsBlake'}Message: |