From ba481e666545c8a06dc6fd8eb0f79924c88c7d19 Mon Sep 17 00:00:00 2001 From: alesapin Date: Fri, 27 Nov 2020 16:17:10 +0300 Subject: [PATCH] Fix cache size calculation --- src/Storages/MarkCache.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Storages/MarkCache.h b/src/Storages/MarkCache.h index 6e36a941fff..5dfaa9ef0ea 100644 --- a/src/Storages/MarkCache.h +++ b/src/Storages/MarkCache.h @@ -21,10 +21,12 @@ namespace DB /// Estimate of number of bytes in cache for marks. struct MarksWeightFunction { + /// We spent additional bytes on key in hashmap, linked lists, shared pointers, etc ... + static constexpr size_t MARK_CACHE_OVERHEAD = 128; + size_t operator()(const MarksInCompressedFile & marks) const { - /// NOTE Could add extra 100 bytes for overhead of std::vector, cache structures and allocator. - return marks.size() * sizeof(MarkInCompressedFile); + return marks.size() * sizeof(MarkInCompressedFile) + MARK_CACHE_OVERHEAD; } };