From 87b1e0ead238e032c100a54697093c87908217f0 Mon Sep 17 00:00:00 2001 From: kssenii Date: Thu, 21 Mar 2024 18:22:11 +0100 Subject: [PATCH] Add more logging --- src/Interpreters/Cache/LRUFileCachePriority.cpp | 1 + src/Interpreters/Cache/LRUFileCachePriority.h | 2 +- src/Interpreters/Cache/SLRUFileCachePriority.cpp | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Interpreters/Cache/LRUFileCachePriority.cpp b/src/Interpreters/Cache/LRUFileCachePriority.cpp index 04622d54a17..ca2127d1c8c 100644 --- a/src/Interpreters/Cache/LRUFileCachePriority.cpp +++ b/src/Interpreters/Cache/LRUFileCachePriority.cpp @@ -37,6 +37,7 @@ LRUFileCachePriority::LRUFileCachePriority( const std::string & description_) : IFileCachePriority(max_size_, max_elements_) , description(description_) + , log(getLogger("LRUFileCachePriority{}" + (description.empty() ? "" : "(" + description + ")"))) { if (state_) state = state_; diff --git a/src/Interpreters/Cache/LRUFileCachePriority.h b/src/Interpreters/Cache/LRUFileCachePriority.h index 1f80cfac170..3dea459e271 100644 --- a/src/Interpreters/Cache/LRUFileCachePriority.h +++ b/src/Interpreters/Cache/LRUFileCachePriority.h @@ -86,7 +86,7 @@ private: LRUQueue queue; const std::string description; - LoggerPtr log = getLogger("LRUFileCachePriority"); + LoggerPtr log; StatePtr state; void updateElementsCount(int64_t num); diff --git a/src/Interpreters/Cache/SLRUFileCachePriority.cpp b/src/Interpreters/Cache/SLRUFileCachePriority.cpp index 07d04ee7876..e59a2fcd68f 100644 --- a/src/Interpreters/Cache/SLRUFileCachePriority.cpp +++ b/src/Interpreters/Cache/SLRUFileCachePriority.cpp @@ -215,7 +215,16 @@ bool SLRUFileCachePriority::collectCandidatesForEviction( hold_space = std::make_shared( hold_size, hold_elements, QueueEntryType::SLRU_Probationary, probationary_queue, lock); + + LOG_TEST(log, "Eviction candidates: {}, hold space: {} in size and {} in elements. {}", + res.size(), hold_size, hold_elements, getStateInfoForLog(lock)); } + else + { + LOG_TEST(log, "Eviction candidates: {}, hold space: none. {}", + res.size(), getStateInfoForLog(lock)); + } + auto downgrade_func = [=, this] (const CachePriorityGuard::Lock & lk)