- 
    Type:Task 
- 
    Resolution: Fixed
- 
    Priority:Major - P3 
- 
    Affects Version/s: None
- 
    Component/s: Replication
- 
    None
- 
        Fully Compatible
- 
        Repl 2019-05-20, Repl 2019-06-03
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
Currently, there is a 3 way deadlock. Assume that we are transitioning from secondary to primary(signalDrainComplete).
- Thread A (Read thread) acquires RSTL lock in IX and blocked by a prepared txn due to prepare conflict.
- Stepup enqueues RSTL lock in X mode. And blocked behind A.
- Prepared txn won’t be able commit until we are able to change our state to primary.
Alternatively, thread A might have got blocked on prepare conflict due to conflicting DB/ collection lock. For eg. dbhash cmd. 
EDIT: Blocked due to conflicting mongoDB locks is not possible as secondary prepared txn yield mongoDB locks.
- depends on
- 
                    SERVER-37574 Force reconfig should kill user operations -         
- Closed
 
-         
- 
                    SERVER-40700 Deadlock between read prepare conflicts and state transitions -         
- Closed
 
-         
- related to
- 
                    SERVER-41035 Rollback should kill all user operations before taking RSTL lock in X. -         
- Closed
 
-         
- 
                    SERVER-41216 Rename InterruptedDueToStepDown error code to InterruptedDueToReplStateChange -         
- Closed
 
-         
- 
                    SERVER-37988 recover locks on step up at the beginning of the state transition rather than at the end -         
- Closed
 
-