diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-10-24 11:43:57 +0200 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-10-25 18:56:12 +0200 |
commit | 58cfddf1bdc0aca99a9dcb5666279349621fd156 (patch) | |
tree | 3df5cf832bf81f87cb4ce2a1bfceab4328cccb7b /src/mongo/db/session_catalog.cpp | |
parent | 1b897361cdf0119bec00400e4ca287809e87c79b (diff) | |
download | mongo-58cfddf1bdc0aca99a9dcb5666279349621fd156.tar.gz |
SERVER-37711 Revert commits related to lock yielding for prepared transactions on step down
This change reverts the following commits:
* SERVER-35870 Allow stepdown to work with prepared transactions (f96903979ac329a760e7b6f1bb5d8695d3daf2a7)
* SERVER-36913 Add functionality to LockManager for repl state transitions with prepared transactions (e65ff57e108ed69c46cc0b0ccbdd675663de2469)
* SERVER-35870 Allow more than one thread to block Session checkout at a time (9406af079a894bae80fbbec4703b04974bf84476)
* SERVER-35870 Add functionality to prevent Session checkouts & wait for all Sessions to be checked in (c6d90316d6b694e12426274c713a4a078e004fc5)
Diffstat (limited to 'src/mongo/db/session_catalog.cpp')
-rw-r--r-- | src/mongo/db/session_catalog.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp index cc1616626de..059c6639f39 100644 --- a/src/mongo/db/session_catalog.cpp +++ b/src/mongo/db/session_catalog.cpp @@ -83,10 +83,6 @@ ScopedCheckedOutSession SessionCatalog::checkOutSession(OperationContext* opCtx) stdx::unique_lock<stdx::mutex> ul(_mutex); - while (!_isSessionCheckoutAllowed()) { - opCtx->waitForConditionOrInterrupt(_checkingOutSessionsAllowedCond, ul); - } - auto sri = _getOrCreateSessionRuntimeInfo(ul, opCtx, lsid); // Wait until the session is no longer checked out @@ -95,7 +91,6 @@ ScopedCheckedOutSession SessionCatalog::checkOutSession(OperationContext* opCtx) invariant(!sri->checkedOut); sri->checkedOut = true; - ++_numCheckedOutSessions; return ScopedCheckedOutSession(opCtx, ScopedSession(std::move(sri))); } @@ -174,7 +169,6 @@ void SessionCatalog::scanSessions(OperationContext* opCtx, std::shared_ptr<SessionCatalog::SessionRuntimeInfo> SessionCatalog::_getOrCreateSessionRuntimeInfo( WithLock, OperationContext* opCtx, const LogicalSessionId& lsid) { invariant(!opCtx->lockState()->inAWriteUnitOfWork()); - invariant(_isSessionCheckoutAllowed()); auto it = _sessions.find(lsid); if (it == _sessions.end()) { @@ -195,39 +189,6 @@ void SessionCatalog::_releaseSession(const LogicalSessionId& lsid) { sri->checkedOut = false; sri->availableCondVar.notify_one(); - --_numCheckedOutSessions; - if (_numCheckedOutSessions == 0) { - _allSessionsCheckedInCond.notify_all(); - } -} - -SessionCatalog::PreventCheckingOutSessionsBlock::PreventCheckingOutSessionsBlock( - SessionCatalog* sessionCatalog) - : _sessionCatalog(sessionCatalog) { - invariant(sessionCatalog); - - stdx::lock_guard<stdx::mutex> lg(sessionCatalog->_mutex); - ++sessionCatalog->_preventSessionCheckoutRequests; -} - -SessionCatalog::PreventCheckingOutSessionsBlock::~PreventCheckingOutSessionsBlock() { - stdx::lock_guard<stdx::mutex> lg(_sessionCatalog->_mutex); - - invariant(_sessionCatalog->_preventSessionCheckoutRequests > 0); - --_sessionCatalog->_preventSessionCheckoutRequests; - if (_sessionCatalog->_preventSessionCheckoutRequests == 0) { - _sessionCatalog->_checkingOutSessionsAllowedCond.notify_all(); - } -} - -void SessionCatalog::PreventCheckingOutSessionsBlock::waitForAllSessionsToBeCheckedIn( - OperationContext* opCtx) { - stdx::unique_lock<stdx::mutex> ul(_sessionCatalog->_mutex); - - invariant(!_sessionCatalog->_isSessionCheckoutAllowed()); - while (_sessionCatalog->_numCheckedOutSessions > 0) { - opCtx->waitForConditionOrInterrupt(_sessionCatalog->_allSessionsCheckedInCond, ul); - } } OperationContextSession::OperationContextSession(OperationContext* opCtx, bool checkOutSession) |