|
There are two identical pieces of code in CollectionImpl::_insertDocuments() and CollectionImpl::updateDocument() that grab metadata X-lock for capped collections:
if (_shared->_needCappedLock) {
|
// X-lock the metadata resource for this capped collection until the end of the WUOW. This
|
// prevents the primary from executing with more concurrency than secondaries.
|
// See SERVER-21646.
|
Lock::ResourceLock heldUntilEndOfWUOW{
|
opCtx->lockState(), ResourceId(RESOURCE_METADATA, _ns.ns()), MODE_X};
|
}
|
The lock won't be held until the end of WUOW as it will be released after leaving the scope.
Is the comment wrong or is the code wrong?
|