It is generally an anti-pattern to be holding a lock on either the Global or RSTL resources when waiting on a condition variable through the.OperationContext.
There is currently no programmatic way to enforce this convention, which has led to issues such as
SERVER-48617, in IndexBuildsCoordinatorMongod::startIndexBuild().
We should look into introducing in invariant to enforcing this convention for most usages of OperationContext as a condition variable. There will be a few exceptions to consider - one such case is in the LockManager's internal lock acquisition logic.
- is related to
SERVER-67015 Investigate circumstances under which we wait while holding locks
- related to
SERVER-48617 Concurrent 'createIndexes' can block all write operations on a primary and standalone by exhausting write tickets.