summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2020-09-08 08:14:06 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-08 18:10:54 +0000
commit26166944f65eb4b1b3d4cfa29ddc1c0ee4e534b4 (patch)
treef62d7fcc413acf279402d0abb763ff6da98cf515 /src
parent4edfad49d10c3f75cf1fbc2f909e424d79f4a7e1 (diff)
downloadmongo-26166944f65eb4b1b3d4cfa29ddc1c0ee4e534b4.tar.gz
SERVER-50789 Use the ReadThroughCache's mutex when accessing `_minTimeInStore`
Diffstat (limited to 'src')
-rw-r--r--src/mongo/util/read_through_cache.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/util/read_through_cache.h b/src/mongo/util/read_through_cache.h
index 7d2e24b9b20..3d5c7bf0923 100644
--- a/src/mongo/util/read_through_cache.h
+++ b/src/mongo/util/read_through_cache.h
@@ -544,7 +544,11 @@ public:
if constexpr (std::is_same_v<Time, CacheNotCausallyConsistent>) {
return _cache._lookupFn(opCtx, _key, _cachedValue);
} else {
- return _cache._lookupFn(opCtx, _key, _cachedValue, _minTimeInStore);
+ auto minTimeInStore = [&] {
+ stdx::lock_guard lg(_cache._mutex);
+ return _minTimeInStore;
+ }();
+ return _cache._lookupFn(opCtx, _key, _cachedValue, minTimeInStore);
}
});
}));