This is an automated email from the ASF dual-hosted git repository.

hello-stephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f0ab5608c1 [fix](be) Fix file cache queue evict size metrics (#64897)
7f0ab5608c1 is described below

commit 7f0ab5608c1f716ff9472f836121d6af4579da96
Author: deardeng <[email protected]>
AuthorDate: Tue Jun 30 14:52:13 2026 +0800

    [fix](be) Fix file cache queue evict size metrics (#64897)
    
    Problem Summary: File cache queue evict size metrics were constructed
    with literal array indexes, while increments use FileCacheType enum
    values. Because FileCacheType maps DISPOSABLE to 0 and INDEX to 2,
    file_cache_index_queue_evict_size actually counted disposable queue
    evictions, and file_cache_disposable_queue_evict_size counted index
    queue evictions. This change initializes the metrics array with explicit
    FileCacheType indexes so each bvar name matches the queue type that
    increments it.
---
 be/src/io/cache/block_file_cache.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/be/src/io/cache/block_file_cache.cpp 
b/be/src/io/cache/block_file_cache.cpp
index 47940b9e83a..a7a199355a1 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -206,13 +206,13 @@ BlockFileCache::BlockFileCache(const std::string& 
cache_base_path,
     _cur_disposable_queue_cache_size_metrics = 
std::make_shared<bvar::Status<size_t>>(
             _cache_base_path.c_str(), 
"file_cache_disposable_queue_cache_size", 0);
 
-    _queue_evict_size_metrics[0] = std::make_shared<bvar::Adder<size_t>>(
-            _cache_base_path.c_str(), "file_cache_index_queue_evict_size");
-    _queue_evict_size_metrics[1] = std::make_shared<bvar::Adder<size_t>>(
-            _cache_base_path.c_str(), "file_cache_normal_queue_evict_size");
-    _queue_evict_size_metrics[2] = std::make_shared<bvar::Adder<size_t>>(
+    _queue_evict_size_metrics[FileCacheType::DISPOSABLE] = 
std::make_shared<bvar::Adder<size_t>>(
             _cache_base_path.c_str(), 
"file_cache_disposable_queue_evict_size");
-    _queue_evict_size_metrics[3] = std::make_shared<bvar::Adder<size_t>>(
+    _queue_evict_size_metrics[FileCacheType::NORMAL] = 
std::make_shared<bvar::Adder<size_t>>(
+            _cache_base_path.c_str(), "file_cache_normal_queue_evict_size");
+    _queue_evict_size_metrics[FileCacheType::INDEX] = 
std::make_shared<bvar::Adder<size_t>>(
+            _cache_base_path.c_str(), "file_cache_index_queue_evict_size");
+    _queue_evict_size_metrics[FileCacheType::TTL] = 
std::make_shared<bvar::Adder<size_t>>(
             _cache_base_path.c_str(), "file_cache_ttl_cache_evict_size");
     _total_evict_size_metrics = std::make_shared<bvar::Adder<size_t>>(
             _cache_base_path.c_str(), "file_cache_total_evict_size");
@@ -1554,7 +1554,7 @@ void BlockFileCache::remove(FileBlockSPtr file_block, T& 
cache_lock, U& block_lo
                                           cell->file_block->get_hash_value(),
                                           cell->file_block->offset(), 
cell->size());
     }
-    *_queue_evict_size_metrics[static_cast<int>(file_block->cache_type())]
+    *_queue_evict_size_metrics[file_cache_type_index(file_block->cache_type())]
             << file_block->range().size();
     *_total_evict_size_metrics << file_block->range().size();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to