diff options
author | Blake Oler <blake.oler@mongodb.com> | 2018-10-10 10:48:11 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2018-10-13 17:47:24 -0400 |
commit | 6894b72f134534c3739a66ed9eee11e265b9c1e1 (patch) | |
tree | 141d2c0600511357c8edf93ba5c4a7070be47b0f /src/mongo/db/logical_session_cache_impl.cpp | |
parent | aa89fef4ac12249077ff8701b465d0b9f733fd2c (diff) | |
download | mongo-6894b72f134534c3739a66ed9eee11e265b9c1e1.tar.gz |
SERVER-36964 Prevent secondaries in SessionsCollectionRS from attempting to set up the sessions collection.
Diffstat (limited to 'src/mongo/db/logical_session_cache_impl.cpp')
-rw-r--r-- | src/mongo/db/logical_session_cache_impl.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/mongo/db/logical_session_cache_impl.cpp b/src/mongo/db/logical_session_cache_impl.cpp index 1b7fceb0f4e..834c29f86f3 100644 --- a/src/mongo/db/logical_session_cache_impl.cpp +++ b/src/mongo/db/logical_session_cache_impl.cpp @@ -219,10 +219,18 @@ Status LogicalSessionCacheImpl::_reap(Client* client) { return uniqueCtx->get(); }(); - auto res = _sessionsColl->setupSessionsCollection(opCtx); - if (!res.isOK()) { - log() << "Sessions collection is not set up; " - << "waiting until next sessions reap interval: " << res.reason(); + auto existsStatus = _sessionsColl->checkSessionsCollectionExists(opCtx); + if (!existsStatus.isOK()) { + StringData notSetUpWarning = + "Sessions collection is not set up; " + "waiting until next sessions reap interval"; + if (existsStatus.code() != ErrorCodes::NamespaceNotFound || + existsStatus.code() != ErrorCodes::NamespaceNotSharded) { + log() << notSetUpWarning << ": " << existsStatus.reason(); + } else { + log() << notSetUpWarning; + } + return Status::OK(); } @@ -282,10 +290,11 @@ void LogicalSessionCacheImpl::_refresh(Client* client) { return uniqueCtx->get(); }(); - auto res = _sessionsColl->setupSessionsCollection(opCtx); - if (!res.isOK()) { + auto setupStatus = _sessionsColl->setupSessionsCollection(opCtx); + + if (!setupStatus.isOK()) { log() << "Sessions collection is not set up; " - << "waiting until next sessions refresh interval: " << res.reason(); + << "waiting until next sessions refresh interval: " << setupStatus.reason(); return; } |