mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
Merge pull request #50533 from kssenii/add-some-metrics
Add profile events for fs cache eviction
This commit is contained in:
commit
640b758ab0
@ -381,6 +381,9 @@ The server successfully detected this situation and will download merged part fr
|
|||||||
M(CachedWriteBufferCacheWriteBytes, "Bytes written from source (remote fs, etc) to filesystem cache") \
|
M(CachedWriteBufferCacheWriteBytes, "Bytes written from source (remote fs, etc) to filesystem cache") \
|
||||||
M(CachedWriteBufferCacheWriteMicroseconds, "Time spent writing data into filesystem cache") \
|
M(CachedWriteBufferCacheWriteMicroseconds, "Time spent writing data into filesystem cache") \
|
||||||
\
|
\
|
||||||
|
M(FilesystemCacheEvictedBytes, "Number of bytes evicted from filesystem cache") \
|
||||||
|
M(FilesystemCacheEvictedFileSegments, "Number of file segments evicted from filesystem cache") \
|
||||||
|
\
|
||||||
M(RemoteFSSeeks, "Total number of seeks for async buffer") \
|
M(RemoteFSSeeks, "Total number of seeks for async buffer") \
|
||||||
M(RemoteFSPrefetches, "Number of prefetches made with asynchronous reading from remote filesystem") \
|
M(RemoteFSPrefetches, "Number of prefetches made with asynchronous reading from remote filesystem") \
|
||||||
M(RemoteFSCancelledPrefetches, "Number of cancelled prefecthes (because of seek)") \
|
M(RemoteFSCancelledPrefetches, "Number of cancelled prefecthes (because of seek)") \
|
||||||
|
@ -17,6 +17,12 @@
|
|||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
namespace ProfileEvents
|
||||||
|
{
|
||||||
|
extern const Event FilesystemCacheEvictedBytes;
|
||||||
|
extern const Event FilesystemCacheEvictedFileSegments;
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -643,7 +649,9 @@ bool FileCache::tryReserve(FileSegment & file_segment, const size_t size)
|
|||||||
return PriorityIterationResult::CONTINUE;
|
return PriorityIterationResult::CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TODO: we can resize if partially downloaded instead.
|
ProfileEvents::increment(ProfileEvents::FilesystemCacheEvictedFileSegments);
|
||||||
|
ProfileEvents::increment(ProfileEvents::FilesystemCacheEvictedBytes, segment->range().size());
|
||||||
|
|
||||||
locked_key.removeFileSegment(segment->offset(), segment->lock());
|
locked_key.removeFileSegment(segment->offset(), segment->lock());
|
||||||
return PriorityIterationResult::REMOVE_AND_CONTINUE;
|
return PriorityIterationResult::REMOVE_AND_CONTINUE;
|
||||||
}
|
}
|
||||||
@ -721,6 +729,10 @@ bool FileCache::tryReserve(FileSegment & file_segment, const size_t size)
|
|||||||
chassert(candidate->releasable());
|
chassert(candidate->releasable());
|
||||||
|
|
||||||
const auto * segment = candidate->file_segment.get();
|
const auto * segment = candidate->file_segment.get();
|
||||||
|
|
||||||
|
ProfileEvents::increment(ProfileEvents::FilesystemCacheEvictedFileSegments);
|
||||||
|
ProfileEvents::increment(ProfileEvents::FilesystemCacheEvictedBytes, segment->range().size());
|
||||||
|
|
||||||
locked_key->removeFileSegment(segment->offset(), segment->lock());
|
locked_key->removeFileSegment(segment->offset(), segment->lock());
|
||||||
segment->getQueueIterator()->remove(cache_lock);
|
segment->getQueueIterator()->remove(cache_lock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user