From f5c2680d3e3f28f4e32e2f5fbbbc61c39d55c2c8 Mon Sep 17 00:00:00 2001 From: Charlie Swanson Date: Thu, 15 Feb 2018 15:33:51 -0500 Subject: SERVER-33358 Inline dassert boolean in ClientCursorPin The check of the lock state was showing up in a performance trace of a non-debug build. --- src/mongo/db/clientcursor.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 3b0f6b4d297..ff3a3cba0c0 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -209,9 +209,8 @@ void ClientCursorPin::release() { // Note it's not safe to dereference _cursor->_cursorManager unless we know we haven't been // killed. If we're not locked we assume we haven't been killed because we're working with the // global cursor manager which never kills cursors. - const bool isLocked = - _opCtx->lockState()->isCollectionLockedForMode(_cursor->_nss.ns(), MODE_IS); - dassert(isLocked || _cursor->_cursorManager->isGlobalManager()); + dassert(_opCtx->lockState()->isCollectionLockedForMode(_cursor->_nss.ns(), MODE_IS) || + _cursor->_cursorManager->isGlobalManager()); invariant(_cursor->_operationUsingCursor); @@ -242,9 +241,8 @@ void ClientCursorPin::deleteUnderlying() { // Note it's not safe to dereference _cursor->_cursorManager unless we know we haven't been // killed. If we're not locked we assume we haven't been killed because we're working with the // global cursor manager which never kills cursors. - const bool isLocked = - _opCtx->lockState()->isCollectionLockedForMode(_cursor->_nss.ns(), MODE_IS); - dassert(isLocked || _cursor->_cursorManager->isGlobalManager()); + dassert(_opCtx->lockState()->isCollectionLockedForMode(_cursor->_nss.ns(), MODE_IS) || + _cursor->_cursorManager->isGlobalManager()); if (!_cursor->getExecutor()->isMarkedAsKilled()) { _cursor->_cursorManager->deregisterCursor(_cursor); -- cgit v1.2.1