diff options
author | Blake Oler <blake.oler@mongodb.com> | 2018-10-05 12:15:33 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2018-10-06 10:18:30 -0400 |
commit | 6e3322c83038a85f2bba932d689f0340c51778ce (patch) | |
tree | c71d1184c0624264f5c4421a812dff60903d3778 | |
parent | 16154b589e832ad92f731c6da17193c067625745 (diff) | |
download | mongo-6e3322c83038a85f2bba932d689f0340c51778ce.tar.gz |
SERVER-36850 Change the LogicalSessionCache refresh parameter granularity from minutes to milliseconds
(cherry picked from commit 1828360710a6f44da6e95d1fe4760412ad65c848)
-rw-r--r-- | src/mongo/db/logical_session_cache_impl.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/logical_session_cache_impl.h | 14 | ||||
-rw-r--r-- | src/mongo/db/logical_session_cache_test.cpp | 3 |
3 files changed, 10 insertions, 11 deletions
diff --git a/src/mongo/db/logical_session_cache_impl.cpp b/src/mongo/db/logical_session_cache_impl.cpp index fa7e533cad5..1b7fceb0f4e 100644 --- a/src/mongo/db/logical_session_cache_impl.cpp +++ b/src/mongo/db/logical_session_cache_impl.cpp @@ -46,7 +46,7 @@ namespace mongo { MONGO_EXPORT_STARTUP_SERVER_PARAMETER( - logicalSessionRefreshMinutes, + logicalSessionRefreshMillis, int, LogicalSessionCacheImpl::kLogicalSessionDefaultRefresh.count()); @@ -54,7 +54,7 @@ MONGO_EXPORT_STARTUP_SERVER_PARAMETER(disableLogicalSessionCacheRefresh, bool, f MONGO_EXPORT_STARTUP_SERVER_PARAMETER(maxSessions, int, 1'000'000); -constexpr Minutes LogicalSessionCacheImpl::kLogicalSessionDefaultRefresh; +constexpr Milliseconds LogicalSessionCacheImpl::kLogicalSessionDefaultRefresh; LogicalSessionCacheImpl::LogicalSessionCacheImpl( std::unique_ptr<ServiceLiaison> service, diff --git a/src/mongo/db/logical_session_cache_impl.h b/src/mongo/db/logical_session_cache_impl.h index 1703ab05cad..e506c2afddd 100644 --- a/src/mongo/db/logical_session_cache_impl.h +++ b/src/mongo/db/logical_session_cache_impl.h @@ -45,7 +45,7 @@ class Client; class OperationContext; class ServiceContext; -extern int logicalSessionRefreshMinutes; +extern int logicalSessionRefreshMillis; /** * A thread-safe cache structure for logical session records. @@ -55,7 +55,7 @@ extern int logicalSessionRefreshMinutes; */ class LogicalSessionCacheImpl final : public LogicalSessionCache { public: - static constexpr Minutes kLogicalSessionDefaultRefresh = Minutes(5); + static constexpr Milliseconds kLogicalSessionDefaultRefresh = Milliseconds(5 * 60 * 1000); /** * An Options type to support the LogicalSessionCacheImpl. @@ -75,13 +75,13 @@ public: /** * The interval over which the cache will refresh session records. * - * By default, this is set to every 5 minutes. If the caller is - * setting the sessionTimeout by hand, it is suggested that they + * By default, this is set to every 5 minutes (300,000). If the caller + * is setting the sessionTimeout by hand, it is suggested that they * consider also setting the refresh interval accordingly. * - * May be set with --setParameter logicalSessionRefreshMinutes=X. + * May be set with --setParameter logicalSessionRefreshMillis=X. */ - Minutes refreshInterval = Minutes(logicalSessionRefreshMinutes); + Milliseconds refreshInterval = Milliseconds(logicalSessionRefreshMillis); }; /** @@ -148,7 +148,7 @@ private: */ Status _addToCache(LogicalSessionRecord record); - const Minutes _refreshInterval; + const Milliseconds _refreshInterval; const Minutes _sessionTimeout; // This value is only modified under the lock, and is modified diff --git a/src/mongo/db/logical_session_cache_test.cpp b/src/mongo/db/logical_session_cache_test.cpp index b8ec36827fe..60780e6ec8d 100644 --- a/src/mongo/db/logical_session_cache_test.cpp +++ b/src/mongo/db/logical_session_cache_test.cpp @@ -53,8 +53,7 @@ namespace mongo { namespace { const Milliseconds kSessionTimeout = duration_cast<Milliseconds>(kLogicalSessionDefaultTimeout); -const Milliseconds kForceRefresh = - duration_cast<Milliseconds>(LogicalSessionCacheImpl::kLogicalSessionDefaultRefresh); +const Milliseconds kForceRefresh = LogicalSessionCacheImpl::kLogicalSessionDefaultRefresh; using SessionList = std::list<LogicalSessionId>; using unittest::EnsureFCV; |