diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2020-09-08 08:14:06 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-08 18:10:54 +0000 |
commit | 26166944f65eb4b1b3d4cfa29ddc1c0ee4e534b4 (patch) | |
tree | f62d7fcc413acf279402d0abb763ff6da98cf515 /src | |
parent | 4edfad49d10c3f75cf1fbc2f909e424d79f4a7e1 (diff) | |
download | mongo-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.h | 6 |
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); } }); })); |