From c122e4dd1f09189b3b9565a0c94a287002e7b60e Mon Sep 17 00:00:00 2001 From: kssenii Date: Fri, 23 Sep 2022 15:32:05 +0200 Subject: [PATCH] Refactor log levels --- .../IO/CachedOnDiskReadBufferFromFile.cpp | 19 ++++++------------- .../Cache/LRUFileCachePriority.cpp | 6 +++--- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp b/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp index da7f8c871cb..b6184aa4b15 100644 --- a/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp +++ b/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp @@ -240,7 +240,6 @@ CachedOnDiskReadBufferFromFile::ImplementationBufferPtr CachedOnDiskReadBufferFromFile::getReadBufferForFileSegment(FileSegmentPtr & file_segment) { auto download_state = file_segment->state(); - LOG_TEST(log, "getReadBufferForFileSegment: {}", file_segment->getInfoForLog()); if (settings.read_from_filesystem_cache_if_exists_otherwise_bypass_cache) { @@ -251,7 +250,7 @@ CachedOnDiskReadBufferFromFile::getReadBufferForFileSegment(FileSegmentPtr & fil } else { - LOG_DEBUG(log, "Bypassing cache because `read_from_filesystem_cache_if_exists_otherwise_bypass_cache` option is used"); + LOG_TRACE(log, "Bypassing cache because `read_from_filesystem_cache_if_exists_otherwise_bypass_cache` option is used"); read_type = ReadType::REMOTE_FS_READ_BYPASS_CACHE; return getRemoteFSReadBuffer(*file_segment, read_type); } @@ -263,7 +262,7 @@ CachedOnDiskReadBufferFromFile::getReadBufferForFileSegment(FileSegmentPtr & fil { case FileSegment::State::SKIP_CACHE: { - LOG_DEBUG(log, "Bypassing cache because file segment state is `SKIP_CACHE`"); + LOG_TRACE(log, "Bypassing cache because file segment state is `SKIP_CACHE`"); read_type = ReadType::REMOTE_FS_READ_BYPASS_CACHE; return getRemoteFSReadBuffer(*file_segment, read_type); } @@ -358,7 +357,7 @@ CachedOnDiskReadBufferFromFile::getReadBufferForFileSegment(FileSegmentPtr & fil } else { - LOG_DEBUG( + LOG_TRACE( log, "Bypassing cache because file segment state is `PARTIALLY_DOWNLOADED_NO_CONTINUATION` and downloaded part already used"); read_type = ReadType::REMOTE_FS_READ_BYPASS_CACHE; @@ -658,7 +657,7 @@ void CachedOnDiskReadBufferFromFile::predownload(FileSegmentPtr & file_segment) implementation_buffer->setReadUntilPosition(file_segment->range().right + 1); /// [..., range.right] implementation_buffer->seek(file_offset_of_buffer_end, SEEK_SET); - LOG_TEST( + LOG_TRACE( log, "Predownload failed because of space limit. " "Will read from remote filesystem starting from offset: {}", @@ -786,10 +785,7 @@ bool CachedOnDiskReadBufferFromFile::nextImplStep() assertCorrectness(); if (file_offset_of_buffer_end == read_until_position) - { - LOG_TEST(log, "Read finished on offset {}", file_offset_of_buffer_end); return false; - } if (!initialized) initialize(file_offset_of_buffer_end, getTotalSizeToRead()); @@ -813,10 +809,7 @@ bool CachedOnDiskReadBufferFromFile::nextImplStep() { bool need_complete_file_segment = file_segment->isDownloader(); if (need_complete_file_segment) - { - LOG_TEST(log, "Resetting downloader {} from scope exit", file_segment->getDownloader()); file_segment->completePartAndResetDownloader(); - } } chassert(!file_segment->isDownloader()); @@ -956,12 +949,12 @@ bool CachedOnDiskReadBufferFromFile::nextImplStep() else { chassert(file_segment->state() == FileSegment::State::PARTIALLY_DOWNLOADED_NO_CONTINUATION); - LOG_TEST(log, "Bypassing cache because writeCache method failed"); + LOG_TRACE(log, "Bypassing cache because writeCache method failed"); } } else { - LOG_DEBUG(log, "No space left in cache, will continue without cache download"); + LOG_TRACE(log, "No space left in cache, will continue without cache download"); file_segment->completeWithState(FileSegment::State::PARTIALLY_DOWNLOADED_NO_CONTINUATION); } diff --git a/src/Interpreters/Cache/LRUFileCachePriority.cpp b/src/Interpreters/Cache/LRUFileCachePriority.cpp index 17fbd2c2092..8010b9c682b 100644 --- a/src/Interpreters/Cache/LRUFileCachePriority.cpp +++ b/src/Interpreters/Cache/LRUFileCachePriority.cpp @@ -34,7 +34,7 @@ IFileCachePriority::WriteIterator LRUFileCachePriority::add(const Key & key, siz CurrentMetrics::add(CurrentMetrics::FilesystemCacheSize, size); CurrentMetrics::add(CurrentMetrics::FilesystemCacheElements); - LOG_DEBUG(log, "Added entry into LRU queue, key: {}, offset: {}", key.toString(), offset); + LOG_TRACE(log, "Added entry into LRU queue, key: {}, offset: {}", key.toString(), offset); return std::make_shared(this, iter); } @@ -54,7 +54,7 @@ void LRUFileCachePriority::removeAll(std::lock_guard &) CurrentMetrics::sub(CurrentMetrics::FilesystemCacheSize, cache_size); CurrentMetrics::sub(CurrentMetrics::FilesystemCacheElements, queue.size()); - LOG_DEBUG(log, "Removed all entries from LRU queue"); + LOG_TRACE(log, "Removed all entries from LRU queue"); queue.clear(); cache_size = 0; @@ -88,7 +88,7 @@ void LRUFileCachePriority::LRUFileCacheIterator::removeAndGetNext(std::lock_guar CurrentMetrics::sub(CurrentMetrics::FilesystemCacheSize, queue_iter->size); CurrentMetrics::sub(CurrentMetrics::FilesystemCacheElements); - LOG_DEBUG(cache_priority->log, "Removed entry from LRU queue, key: {}, offset: {}", queue_iter->key.toString(), queue_iter->offset); + LOG_TRACE(cache_priority->log, "Removed entry from LRU queue, key: {}, offset: {}", queue_iter->key.toString(), queue_iter->offset); queue_iter = cache_priority->queue.erase(queue_iter); }