-
Type: Task
-
Resolution: Done
-
Priority: Trivial - P5
-
Affects Version/s: None
-
Component/s: Internal Code, Storage
-
Fully Compatible
-
Storage 2017-11-13
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.