diff options
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() |