summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}
});
}));