Merge pull request #52378 from kgoralski/filesystemCacheSizeLimitMetric

New metric - Filesystem cache size limit
This commit is contained in:
Kseniia Sumarokova 2023-07-23 18:12:11 +02:00 committed by GitHub
commit b6ef57d32e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -187,6 +187,7 @@
M(CacheFileSegments, "Number of existing cache file segments") \
M(CacheDetachedFileSegments, "Number of existing detached cache file segments") \
M(FilesystemCacheSize, "Filesystem cache size in bytes") \
M(FilesystemCacheSizeLimit, "Filesystem cache size limit in bytes") \
M(FilesystemCacheElements, "Filesystem cache elements (file segments)") \
M(FilesystemCacheDownloadQueueElements, "Filesystem cache elements in download queue") \
M(AsyncInsertCacheSize, "Number of async insert hash id in cache") \

View File

@ -5,6 +5,11 @@
#include <Interpreters/Cache/FileCacheKey.h>
#include <Common/logger_useful.h>
namespace CurrentMetrics
{
extern const Metric FilesystemCacheSizeLimit;
}
namespace DB
{
@ -18,7 +23,10 @@ private:
using LRUQueueIterator = typename LRUQueue::iterator;
public:
LRUFileCachePriority(size_t max_size_, size_t max_elements_) : IFileCachePriority(max_size_, max_elements_) {}
LRUFileCachePriority(size_t max_size_, size_t max_elements_) : IFileCachePriority(max_size_, max_elements_)
{
CurrentMetrics::set(CurrentMetrics::FilesystemCacheSizeLimit, max_size_);
}
size_t getSize(const CacheGuard::Lock &) const override { return current_size; }