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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 1b3f158095f branch-3.0: [fix](memory) Fix LRUCachePolicy 
initialization and registration order #49117 (#49124)
1b3f158095f is described below

commit 1b3f158095f34545c5ad6d6805675767d5205346
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Mar 17 16:16:29 2025 +0800

    branch-3.0: [fix](memory) Fix LRUCachePolicy initialization and 
registration order #49117 (#49124)
    
    Cherry-picked from #49117
    
    Co-authored-by: Xinyi Zou <zouxi...@selectdb.com>
---
 be/src/runtime/memory/cache_policy.cpp   | 1 -
 be/src/runtime/memory/lru_cache_policy.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/memory/cache_policy.cpp 
b/be/src/runtime/memory/cache_policy.cpp
index 46b9db1b35a..55fb4f3d605 100644
--- a/be/src/runtime/memory/cache_policy.cpp
+++ b/be/src/runtime/memory/cache_policy.cpp
@@ -27,7 +27,6 @@ CachePolicy::CachePolicy(CacheType type, size_t capacity, 
uint32_t stale_sweep_t
           _initial_capacity(capacity),
           _stale_sweep_time_s(stale_sweep_time_s),
           _enable_prune(enable_prune) {
-    CacheManager::instance()->register_cache(this);
     init_profile();
 }
 
diff --git a/be/src/runtime/memory/lru_cache_policy.h 
b/be/src/runtime/memory/lru_cache_policy.h
index b2fb33b1ac5..6fb10c8fd97 100644
--- a/be/src/runtime/memory/lru_cache_policy.h
+++ b/be/src/runtime/memory/lru_cache_policy.h
@@ -48,6 +48,7 @@ public:
             _cache = ExecEnv::GetInstance()->get_dummy_lru_cache();
         }
         _init_mem_tracker(lru_cache_type_string(lru_cache_type));
+        CacheManager::instance()->register_cache(this);
     }
 
     LRUCachePolicy(CacheType type, size_t capacity, LRUCacheType 
lru_cache_type,
@@ -67,6 +68,7 @@ public:
             _cache = ExecEnv::GetInstance()->get_dummy_lru_cache();
         }
         _init_mem_tracker(lru_cache_type_string(lru_cache_type));
+        CacheManager::instance()->register_cache(this);
     }
 
     void reset_cache() { _cache.reset(); }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to