When setting up an index build, we take a collection MODE_X lock. This can lead to a deadlock if there is also a replication state transition along with a prepared transaction. The index builder holds the RSTL in MODE_IX with the state transition waiting to take the RSTL in MODE_X. The index builder can't acquire the collection lock however because a prepared transaction is holding the collection lock in MODE_IX. In particular this is an issue because the index builder is purposely not interrupted for the state transition. See SERVER-44722 describing a similar issue. We should be able to fix this by unlocking the RSTL and retrying with a timeout like we do during index build commit.
- is related to
-
SERVER-71198 Assert that unkillable operations that take X collection locks do not hold the RSTL
- Backlog
-
SERVER-71288 Consolidate index build RSTL unlock/relock logic
- Closed
- related to
-
SERVER-42621 3 way deadlock can happen between hybrid index build, prepared transactions and stepdown thread.
- Closed
-
SERVER-44722 3 way deadlock can happen between hybrid index build, prepared transactions and stepdown thread on primary that runs index build via coordinator.
- Closed