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

gavinchou 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 26f44b513d6 [fix](filecache) add ttl mgr NOT_FOUND cleanup (#60269)
26f44b513d6 is described below

commit 26f44b513d6a6316411257e8312c349c4d548aa7
Author: zhengyu <[email protected]>
AuthorDate: Tue Feb 3 17:07:20 2026 +0800

    [fix](filecache) add ttl mgr NOT_FOUND cleanup (#60269)
    
    1. Drop missing tablet ids on NOT_FOUND to stop repeated TTL meta
    lookups and log spam
    2. add bvar for tablet-id set size to monitor cleanup behavior
---
 be/src/io/cache/block_file_cache_ttl_mgr.cpp | 24 ++++++++++++++++++++++--
 be/src/io/cache/block_file_cache_ttl_mgr.h   |  4 ++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/be/src/io/cache/block_file_cache_ttl_mgr.cpp 
b/be/src/io/cache/block_file_cache_ttl_mgr.cpp
index d1406d08325..65ca767dd93 100644
--- a/be/src/io/cache/block_file_cache_ttl_mgr.cpp
+++ b/be/src/io/cache/block_file_cache_ttl_mgr.cpp
@@ -26,6 +26,7 @@
 
 #include "common/config.h"
 #include "common/logging.h"
+#include "common/status.h"
 #include "io/cache/block_file_cache.h"
 #include "io/cache/cache_block_meta_store.h"
 #include "io/cache/file_block.h"
@@ -37,6 +38,8 @@ namespace doris::io {
 
 BlockFileCacheTtlMgr::BlockFileCacheTtlMgr(BlockFileCache* mgr, 
CacheBlockMetaStore* meta_store)
         : _mgr(mgr), _meta_store(meta_store), _stop_background(false) {
+    _tablet_id_set_size_metrics = std::make_shared<bvar::Status<size_t>>(
+            _mgr->get_base_path().c_str(), 
"file_cache_ttl_mgr_tablet_id_set_size", 0);
     // Start background threads
     _update_ttl_thread =
             
std::thread(&BlockFileCacheTtlMgr::run_backgroud_update_ttl_info_map, this);
@@ -79,6 +82,9 @@ void BlockFileCacheTtlMgr::run_background_tablet_id_flush() {
         }
         std::lock_guard<std::mutex> lock(_tablet_id_mutex);
         _tablet_id_set.insert(items->begin(), items->end());
+        if (_tablet_id_set_size_metrics) {
+            _tablet_id_set_size_metrics->set_value(_tablet_id_set.size());
+        }
         items->clear();
     };
 
@@ -166,8 +172,22 @@ void 
BlockFileCacheTtlMgr::run_backgroud_update_ttl_info_map() {
                 TabletMetaSharedPtr tablet_meta;
                 auto meta_status = ExecEnv::get_tablet_meta(tablet_id, 
&tablet_meta, false);
                 if (!meta_status.ok()) {
-                    LOG(WARNING) << "Failed to get tablet meta for tablet_id: 
" << tablet_id
-                                 << ", err: " << meta_status;
+                    if (meta_status.is<ErrorCode::NOT_FOUND>()) {
+                        {
+                            std::lock_guard<std::mutex> lock(_tablet_id_mutex);
+                            if (_tablet_id_set.erase(tablet_id) > 0 &&
+                                _tablet_id_set_size_metrics) {
+                                
_tablet_id_set_size_metrics->set_value(_tablet_id_set.size());
+                            }
+                        }
+                        {
+                            std::lock_guard<std::mutex> lock(_ttl_info_mutex);
+                            _ttl_info_map.erase(tablet_id);
+                        }
+                    } else {
+                        LOG(WARNING) << "Failed to get tablet meta for 
tablet_id: " << tablet_id
+                                     << ", err: " << meta_status;
+                    }
                     continue;
                 }
 
diff --git a/be/src/io/cache/block_file_cache_ttl_mgr.h 
b/be/src/io/cache/block_file_cache_ttl_mgr.h
index c08438d5d6d..b16b5486b4b 100644
--- a/be/src/io/cache/block_file_cache_ttl_mgr.h
+++ b/be/src/io/cache/block_file_cache_ttl_mgr.h
@@ -19,10 +19,12 @@
 
 #pragma once
 
+#include <bvar/bvar.h>
 #include <concurrentqueue.h>
 
 #include <atomic>
 #include <map>
+#include <memory>
 #include <mutex>
 #include <thread>
 #include <unordered_set>
@@ -73,6 +75,8 @@ private:
     std::thread _tablet_id_flush_thread;
 
     std::mutex _ttl_info_mutex;
+
+    std::shared_ptr<bvar::Status<size_t>> _tablet_id_set_size_metrics;
 };
 
 } // namespace doris::io
\ No newline at end of file


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

Reply via email to