Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-71191

Deadlock between index build setup, prepared transaction, and stepdown

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.1, 4.4.19, 5.0.15, 6.0.4, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.1, v6.0, v5.0, v4.4
    • Execution Team 2022-11-14, Execution Team 2022-11-28
    • 135

      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.

            gregory.noma@mongodb.com Gregory Noma
            gregory.noma@mongodb.com Gregory Noma
            0 Vote for this issue
            7 Start watching this issue