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 663ef81ffe9 [enhancement](cloud) make file cache background task 
interval configu… (#50646)
663ef81ffe9 is described below

commit 663ef81ffe9fe9e16814888f896576c20d78e954
Author: zhengyu <[email protected]>
AuthorDate: Thu May 8 11:44:10 2025 +0800

    [enhancement](cloud) make file cache background task interval configu… 
(#50646)
    
    …rable
    
    pick #49832
    
    Signed-off-by: zhengyu <[email protected]>
---
 be/src/io/cache/block_file_cache.cpp       |  8 ++++----
 be/test/io/cache/block_file_cache_test.cpp | 14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/be/src/io/cache/block_file_cache.cpp 
b/be/src/io/cache/block_file_cache.cpp
index fd88ca74ae5..bad789016ca 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -1775,9 +1775,9 @@ void BlockFileCache::check_need_evict_cache_in_advance() {
 }
 
 void BlockFileCache::run_background_monitor() {
-    int64_t interval_time_seconds = 20;
     while (!_close) {
-        TEST_SYNC_POINT_CALLBACK("BlockFileCache::set_sleep_time", 
&interval_time_seconds);
+        int64_t interval_ms = 
config::file_cache_background_monitor_interval_ms;
+        TEST_SYNC_POINT_CALLBACK("BlockFileCache::set_sleep_time", 
&interval_ms);
         check_disk_resource_limit();
         if (config::enable_evict_file_cache_in_advance) {
             check_need_evict_cache_in_advance();
@@ -1787,7 +1787,7 @@ void BlockFileCache::run_background_monitor() {
 
         {
             std::unique_lock close_lock(_close_mtx);
-            _close_cv.wait_for(close_lock, 
std::chrono::seconds(interval_time_seconds));
+            _close_cv.wait_for(close_lock, 
std::chrono::milliseconds(interval_ms));
             if (_close) {
                 break;
             }
@@ -1866,7 +1866,7 @@ void BlockFileCache::run_background_gc() {
     FileCacheKey key;
     size_t batch_count = 0;
     while (!_close) {
-        size_t interval_ms = config::file_cache_background_gc_interval_ms;
+        int64_t interval_ms = config::file_cache_background_gc_interval_ms;
         size_t batch_limit = config::file_cache_remove_block_qps_limit * 
interval_ms / 1000;
         {
             std::unique_lock close_lock(_close_mtx);
diff --git a/be/test/io/cache/block_file_cache_test.cpp 
b/be/test/io/cache/block_file_cache_test.cpp
index 57a4f073bff..0e62170b760 100644
--- a/be/test/io/cache/block_file_cache_test.cpp
+++ b/be/test/io/cache/block_file_cache_test.cpp
@@ -2173,7 +2173,7 @@ TEST_F(BlockFileCacheTest, ttl_normal) {
     SyncPoint::CallbackGuard guard1;
     sp->set_call_back(
             "BlockFileCache::set_sleep_time",
-            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, 
&guard1);
+            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, 
&guard1);
     sp->enable_processing();
     TUniqueId query_id;
     query_id.hi = 1;
@@ -2272,7 +2272,7 @@ TEST_F(BlockFileCacheTest, ttl_modify) {
     SyncPoint::CallbackGuard guard1;
     sp->set_call_back(
             "BlockFileCache::set_sleep_time",
-            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, 
&guard1);
+            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, 
&guard1);
     sp->enable_processing();
     TUniqueId query_id;
     query_id.hi = 1;
@@ -2355,7 +2355,7 @@ TEST_F(BlockFileCacheTest, ttl_modify_memory_storage) {
     SyncPoint::CallbackGuard guard1;
     sp->set_call_back(
             "BlockFileCache::set_sleep_time",
-            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, 
&guard1);
+            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, 
&guard1);
     sp->enable_processing();
     TUniqueId query_id;
     query_id.hi = 1;
@@ -3060,7 +3060,7 @@ TEST_F(BlockFileCacheTest, recyle_cache_async_ttl) {
     SyncPoint::CallbackGuard guard1;
     sp->set_call_back(
             "BlockFileCache::set_sleep_time",
-            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, 
&guard1);
+            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, 
&guard1);
     SyncPoint::CallbackGuard guard2;
     sp->set_call_back(
             "BlockFileCache::set_remove_batch",
@@ -3190,7 +3190,7 @@ TEST_F(BlockFileCacheTest, test_factory_1) {
     SyncPoint::CallbackGuard guard1;
     sp->set_call_back(
             "BlockFileCache::set_sleep_time",
-            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, 
&guard1);
+            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, 
&guard1);
     SyncPoint::CallbackGuard guard2;
     sp->set_call_back(
             "BlockFileCache::set_remove_batch",
@@ -4963,7 +4963,7 @@ TEST_F(BlockFileCacheTest, reset_capacity) {
         sp->clear_call_back("BlockFileCache::set_sleep_time");
     }};
     sp->set_call_back("BlockFileCache::set_sleep_time",
-                      [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; 
});
+                      [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 
1000; });
     sp->set_call_back("BlockFileCache::set_remove_batch",
                       [](auto&& args) { *try_any_cast<int*>(args[0]) = 2; });
     sp->enable_processing();
@@ -6815,7 +6815,7 @@ TEST_F(BlockFileCacheTest, evict_in_advance) {
     SyncPoint::CallbackGuard guard1;
     sp->set_call_back(
             "BlockFileCache::set_sleep_time",
-            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, 
&guard1);
+            [](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, 
&guard1);
     sp->enable_processing();
     fs::create_directories(cache_base_path);
     TUniqueId query_id;


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

Reply via email to