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

Calls to take resource lock unnecessarily check for null Locker on OperationContext

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Storage 2017-11-13

      Description

      std::unique_ptr<Lock::ResourceLock> rLk;
      if (!_isRsThreadSafe && opCtx->lockState()) {
          rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, MODE_X));
      }
      

      Prior to https://github.com/mongodb/mongo/commit/12d82c741061da23a442086465322352f157d094#diff-a7d065bc58d47728c995d090e64d88ad, it was possible for an OperationContextNoop to return a nullptr when OperationContext::lockState() was called. This was done to allow use of the KVCatalog class in C++ unit tests against storage engines that don't support document-level concurrency. However, OperationContext::lockState() should never return nullptr after the introduction of the LockerNoop class, so the additional && opCtx->lockState() condition can be removed.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: