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

Locks for capped collection's metadata in CollectionImpl don't seem to do what they claim

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Community Answered
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • ALL

    Description

      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?

      Attachments

        Activity

          People

            dmitry.agranat@mongodb.com Dmitry Agranat
            fordeso2@gmail.com Denis Protivensky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: