diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-10-31 16:38:01 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-31 16:38:01 +0000 |
commit | 1f94484d52064e12baedc7b586a8238d63560baf (patch) | |
tree | 5bb03cebfcb2d3137321b4762a0500f8831463dd /src/mongo/db/logical_session_cache_impl.cpp | |
parent | 7a3d17ea6b73bc916d94e59a44d5c1a56cbcb2e5 (diff) | |
download | mongo-1f94484d52064e12baedc7b586a8238d63560baf.tar.gz |
SERVER-42508 Get rid of some additional unused code in SessionsCollection
... and also improve comments.
Diffstat (limited to 'src/mongo/db/logical_session_cache_impl.cpp')
-rw-r--r-- | src/mongo/db/logical_session_cache_impl.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/db/logical_session_cache_impl.cpp b/src/mongo/db/logical_session_cache_impl.cpp index 2d8834461ab..eae770cfecc 100644 --- a/src/mongo/db/logical_session_cache_impl.cpp +++ b/src/mongo/db/logical_session_cache_impl.cpp @@ -87,14 +87,14 @@ void LogicalSessionCacheImpl::joinOnShutDown() { Status LogicalSessionCacheImpl::startSession(OperationContext* opCtx, const LogicalSessionRecord& record) { stdx::lock_guard lg(_mutex); - return _addToCache(lg, record); + return _addToCacheIfNotFull(lg, record); } Status LogicalSessionCacheImpl::vivify(OperationContext* opCtx, const LogicalSessionId& lsid) { stdx::lock_guard lg(_mutex); auto it = _activeSessions.find(lsid); if (it == _activeSessions.end()) - return _addToCache(lg, makeLogicalSessionRecord(opCtx, lsid, _service->now())); + return _addToCacheIfNotFull(lg, makeLogicalSessionRecord(opCtx, lsid, _service->now())); auto& cacheEntry = it->second; cacheEntry.setLastUse(_service->now()); @@ -102,17 +102,17 @@ Status LogicalSessionCacheImpl::vivify(OperationContext* opCtx, const LogicalSes return Status::OK(); } -Status LogicalSessionCacheImpl::refreshNow(Client* client) { +Status LogicalSessionCacheImpl::refreshNow(OperationContext* opCtx) { try { - _refresh(client); + _refresh(opCtx->getClient()); } catch (...) { return exceptionToStatus(); } return Status::OK(); } -Status LogicalSessionCacheImpl::reapNow(Client* client) { - return _reap(client); +void LogicalSessionCacheImpl::reapNow(OperationContext* opCtx) { + uassertStatusOK(_reap(opCtx->getClient())); } size_t LogicalSessionCacheImpl::size() { @@ -242,9 +242,9 @@ void LogicalSessionCacheImpl::_refresh(Client* client) { try { _sessionsColl->setupSessionsCollection(opCtx); - } catch (DBException& ex) { - log() << "Failed to refresh session cache: " << ex.reason() - << ", will try again at the next refresh interval"; + } catch (const DBException& ex) { + log() << "Failed to refresh session cache, will try again at the next refresh interval" + << causedBy(redact(ex)); return; } @@ -365,7 +365,7 @@ LogicalSessionCacheStats LogicalSessionCacheImpl::getStats() { return _stats; } -Status LogicalSessionCacheImpl::_addToCache(WithLock, LogicalSessionRecord record) { +Status LogicalSessionCacheImpl::_addToCacheIfNotFull(WithLock, LogicalSessionRecord record) { if (_activeSessions.size() >= size_t(maxSessions)) { Status status = {ErrorCodes::TooManyLogicalSessions, str::stream() |