summaryrefslogtreecommitdiff
path: root/src/mongo/db/logical_session_cache_impl.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2018-06-20 14:08:35 -0400
committerJason Carey <jcarey@argv.me>2018-06-21 10:40:03 -0400
commitaf7c50e0ac57f50ba258177f0fbd48b8a837001e (patch)
tree8911a78284dcaf1b58139e80b68ffb546ea1a1bd /src/mongo/db/logical_session_cache_impl.cpp
parent1ba4fd11653654df741b5c399a85f38617b21ec8 (diff)
downloadmongo-af7c50e0ac57f50ba258177f0fbd48b8a837001e.tar.gz
SERVER-35706 ctor race in LogicalSessionCacheImpl
The constructor for LogicalSessionCacheImpl writes to fields after it has kicked off periodic jobs that also write to those fields. It doesn't do it for any good reason, so re-order to fix the race.
Diffstat (limited to 'src/mongo/db/logical_session_cache_impl.cpp')
-rw-r--r--src/mongo/db/logical_session_cache_impl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/logical_session_cache_impl.cpp b/src/mongo/db/logical_session_cache_impl.cpp
index a6f1b2b7d45..3c1082dbc35 100644
--- a/src/mongo/db/logical_session_cache_impl.cpp
+++ b/src/mongo/db/logical_session_cache_impl.cpp
@@ -64,6 +64,9 @@ LogicalSessionCacheImpl::LogicalSessionCacheImpl(
_service(std::move(service)),
_sessionsColl(std::move(collection)),
_transactionReaper(std::move(transactionReaper)) {
+ _stats.setLastSessionsCollectionJobTimestamp(now());
+ _stats.setLastTransactionReaperJobTimestamp(now());
+
if (!disableLogicalSessionCacheRefresh) {
_service->scheduleJob({"LogicalSessionCacheRefresh",
[this](Client* client) { _periodicRefresh(client); },
@@ -74,8 +77,6 @@ LogicalSessionCacheImpl::LogicalSessionCacheImpl(
_refreshInterval});
}
}
- _stats.setLastSessionsCollectionJobTimestamp(now());
- _stats.setLastTransactionReaperJobTimestamp(now());
}
LogicalSessionCacheImpl::~LogicalSessionCacheImpl() {