diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-09-06 19:01:03 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-09-06 19:01:03 -0400 |
commit | b78e4b8e753f7980036cd51a052555a29c89bf1c (patch) | |
tree | dbc814d32dec046f43fe0156d2b624e6d66f9c77 /src/mongo/db/session_catalog.cpp | |
parent | 250181f4feb7ac49cec8ff7251f844d69c4710be (diff) | |
download | mongo-b78e4b8e753f7980036cd51a052555a29c89bf1c.tar.gz |
Revert "SERVER-30936 Ensure operation session info is initialized only once"
This reverts commit e00c6d29996ba52b5a77a072d1c5c555f62b8534.
Diffstat (limited to 'src/mongo/db/session_catalog.cpp')
-rw-r--r-- | src/mongo/db/session_catalog.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp index 58034c327ba..4e0a28bb0ac 100644 --- a/src/mongo/db/session_catalog.cpp +++ b/src/mongo/db/session_catalog.cpp @@ -137,15 +137,13 @@ ScopedCheckedOutSession SessionCatalog::checkOutSession(OperationContext* opCtx) invariant(!opCtx->lockState()->isLocked()); invariant(opCtx->getLogicalSessionId()); - const auto& lsid = *opCtx->getLogicalSessionId(); - stdx::unique_lock<stdx::mutex> ul(_mutex); - auto sri = _getOrCreateSessionRuntimeInfo(opCtx, lsid, ul); + auto sri = _getOrCreateSessionRuntimeInfo_inlock(opCtx, *opCtx->getLogicalSessionId(), ul); // Wait until the session is no longer in use opCtx->waitForConditionOrInterrupt( - sri->availableCondVar, ul, [&sri]() { return sri->state != SessionRuntimeInfo::kInUse; }); + sri->availableCondVar, ul, [sri]() { return sri->state != SessionRuntimeInfo::kInUse; }); invariant(sri->state == SessionRuntimeInfo::kAvailable); sri->state = SessionRuntimeInfo::kInUse; @@ -157,7 +155,7 @@ ScopedSession SessionCatalog::getOrCreateSession(OperationContext* opCtx, const LogicalSessionId& lsid) { stdx::unique_lock<stdx::mutex> ul(_mutex); - return ScopedSession(_getOrCreateSessionRuntimeInfo(opCtx, lsid, ul)); + return ScopedSession(_getOrCreateSessionRuntimeInfo_inlock(opCtx, lsid, ul)); } void SessionCatalog::resetSessions() { @@ -167,8 +165,10 @@ void SessionCatalog::resetSessions() { } } -std::shared_ptr<SessionCatalog::SessionRuntimeInfo> SessionCatalog::_getOrCreateSessionRuntimeInfo( - OperationContext* opCtx, const LogicalSessionId& lsid, stdx::unique_lock<stdx::mutex>& ul) { +std::shared_ptr<SessionCatalog::SessionRuntimeInfo> +SessionCatalog::_getOrCreateSessionRuntimeInfo_inlock(OperationContext* opCtx, + const LogicalSessionId& lsid, + stdx::unique_lock<stdx::mutex>& ul) { invariant(!opCtx->lockState()->inAWriteUnitOfWork()); auto it = _txnTable.find(lsid); |