mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Review fix
This commit is contained in:
parent
7cc6eeff0d
commit
15b41fd110
@ -27,7 +27,7 @@ MMapReadBufferFromFileWithCache::MMapReadBufferFromFileWithCache(
|
||||
mapped = cache.getOrSet(cache.hash(file_name, offset, length), [&]
|
||||
{
|
||||
return std::make_shared<MappedFile>(file_name, offset, length);
|
||||
}).first;
|
||||
});
|
||||
|
||||
init();
|
||||
}
|
||||
@ -38,7 +38,7 @@ MMapReadBufferFromFileWithCache::MMapReadBufferFromFileWithCache(
|
||||
mapped = cache.getOrSet(cache.hash(file_name, offset, -1), [&]
|
||||
{
|
||||
return std::make_shared<MappedFile>(file_name, offset);
|
||||
}).first;
|
||||
});
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -44,16 +44,16 @@ public:
|
||||
return key;
|
||||
}
|
||||
|
||||
MappedPtr get(const Key & key)
|
||||
template <typename LoadFunc>
|
||||
MappedPtr getOrSet(const Key & key, LoadFunc && load)
|
||||
{
|
||||
MappedPtr res = Base::get(key);
|
||||
|
||||
if (res)
|
||||
ProfileEvents::increment(ProfileEvents::MappedFileCacheHits);
|
||||
else
|
||||
auto result = Base::getOrSet(key, load);
|
||||
if (result.second)
|
||||
ProfileEvents::increment(ProfileEvents::MappedFileCacheMisses);
|
||||
else
|
||||
ProfileEvents::increment(ProfileEvents::MappedFileCacheHits);
|
||||
|
||||
return res;
|
||||
return result.first;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user