mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Better logger name
This commit is contained in:
parent
f0dac3dfd5
commit
2db1e34517
@ -90,9 +90,15 @@ FileCache::FileCache(const std::string & cache_name, const FileCacheSettings & s
|
||||
, metadata(settings.base_path, settings.background_download_queue_size_limit, settings.background_download_threads, write_cache_per_user_directory)
|
||||
{
|
||||
if (settings.cache_policy == "LRU")
|
||||
main_priority = std::make_unique<LRUFileCachePriority>(settings.max_size, settings.max_elements);
|
||||
{
|
||||
main_priority = std::make_unique<LRUFileCachePriority>(
|
||||
settings.max_size, settings.max_elements, nullptr, cache_name);
|
||||
}
|
||||
else if (settings.cache_policy == "SLRU")
|
||||
main_priority = std::make_unique<SLRUFileCachePriority>(settings.max_size, settings.max_elements, settings.slru_size_ratio);
|
||||
{
|
||||
main_priority = std::make_unique<SLRUFileCachePriority>(
|
||||
settings.max_size, settings.max_elements, settings.slru_size_ratio, nullptr, nullptr, cache_name);
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown cache policy: {}", settings.cache_policy);
|
||||
|
||||
|
@ -28,17 +28,19 @@ SLRUFileCachePriority::SLRUFileCachePriority(
|
||||
size_t max_elements_,
|
||||
double size_ratio_,
|
||||
LRUFileCachePriority::StatePtr probationary_state_,
|
||||
LRUFileCachePriority::StatePtr protected_state_)
|
||||
LRUFileCachePriority::StatePtr protected_state_,
|
||||
const std::string & description_)
|
||||
: IFileCachePriority(max_size_, max_elements_)
|
||||
, size_ratio(size_ratio_)
|
||||
, protected_queue(LRUFileCachePriority(getRatio(max_size_, size_ratio),
|
||||
getRatio(max_elements_, size_ratio),
|
||||
protected_state_,
|
||||
"protected"))
|
||||
description_ + ", protected"))
|
||||
, probationary_queue(LRUFileCachePriority(getRatio(max_size_, 1 - size_ratio),
|
||||
getRatio(max_elements_, 1 - size_ratio),
|
||||
probationary_state_,
|
||||
"probationary"))
|
||||
description_ + ", probationary"))
|
||||
, log(getLogger("SLRUFileCachePriority(" + description_ + ")"))
|
||||
{
|
||||
LOG_DEBUG(
|
||||
log, "Probationary queue {} in size and {} in elements. "
|
||||
|
@ -19,7 +19,8 @@ public:
|
||||
size_t max_elements_,
|
||||
double size_ratio_,
|
||||
LRUFileCachePriority::StatePtr probationary_state_ = nullptr,
|
||||
LRUFileCachePriority::StatePtr protected_state_ = nullptr);
|
||||
LRUFileCachePriority::StatePtr protected_state_ = nullptr,
|
||||
const std::string & description_ = "none");
|
||||
|
||||
size_t getSize(const CachePriorityGuard::Lock & lock) const override;
|
||||
|
||||
@ -67,7 +68,7 @@ private:
|
||||
double size_ratio;
|
||||
LRUFileCachePriority protected_queue;
|
||||
LRUFileCachePriority probationary_queue;
|
||||
LoggerPtr log = getLogger("SLRUFileCachePriority");
|
||||
LoggerPtr log;
|
||||
|
||||
void increasePriority(SLRUIterator & iterator, const CachePriorityGuard::Lock & lock);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user