In the past, when a collection lock is dropped during an index build, there was no chance that the name of the collection would change. Because of this, createIndexes could be sure that for the entire lifetime of the function the name of the collection wouldn't change.
However, SERVER 37720 will allow renameCollection during index builds. This will no longer allow us to be sure that the name of the collection stays the same for the duration of the function.
To fix this, first get a collection X lock on the collection based on the namespace provided by the createIndexes request, fetch the collection UUID under a lock, then use AutoGetCollection to acquire the collection lock by UUID for the remainder of the createIndexes operation.
For the remainder of the function, locks of the collection should be done using AutoGetCollection to lock the collection given the UUID.
- is depended on by
-
SERVER-37720 Allow active index builds during renameCollection
- Blocked
- related to
-
SERVER-42280 IndexBuildsCoordinator starts index build on wrong collection
- Closed
-
SERVER-42487 Acquire locks by UUID in IndexBuildsCoordinator::_buildIndex
- Closed