[SERVER-44028] Remove global X lock for Cloner Created: 15/Oct/19  Updated: 29/Oct/23  Resolved: 01/Nov/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.3.1, 4.2.2

Type: Task Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Issue split
split from SERVER-43242 Deadlock involving commands acquiring... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.2
Sprint: Execution Team 2019-11-04
Participants:

 Description   

Remove global X lock acquisition for Cloner. This is because acquiring global lock in X mode can be blocked by prepared transactions. The enqueued global X lock can block oplog queries which need the global IS lock. If these oplog queries and the data replication are needed to satisfy the prepared transaction's write concern, then the prepare transaction and replication cannot make progress. Thus a deadlock occurs.

Alternatively, if removing global X lock is not an option, deprecate the usage or make sure it won't be blocked on prepare transactions.



 Comments   
Comment by Githook User [ 18/Nov/19 ]

Author:

{'username': 'GWlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'name': 'Gregory Wlodarek'}

Message: SERVER-44028 Remove global X lock for Cloner

(cherry picked from commit 6e1889fb793e1927a5ca695c8839f9184e5d8aa4)
Branch: v4.2
https://github.com/mongodb/mongo/commit/eb4706d4f2fff6fa87197bb7e8d6de2c0c1b49c9

Comment by Githook User [ 01/Nov/19 ]

Author:

{'username': 'GWlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'name': 'Gregory Wlodarek'}

Message: SERVER-44028 Remove global X lock for Cloner
Branch: master
https://github.com/mongodb/mongo/commit/6e1889fb793e1927a5ca695c8839f9184e5d8aa4

Comment by Eric Milkie [ 22/Oct/19 ]

The Cloner is currently used by rollback-via-refetch and by the movePrimary command.
Rollback-via-refetch has no danger of deadlock with prepared transactions.
The movePrimary command does have a danger of deadlock. I recommend changing the Global lock to a Database X lock. The command already acquires a DB X lock prior to calling the Cloner, so this change seems safe to make and should have no effect on movePrimary.

Comment by Eric Milkie [ 16/Oct/19 ]

// XXX: can probably take dblock instead

Generated at Thu Feb 08 05:04:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.