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

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


The following commit(s) were added to refs/heads/branch-4.2 by this push:
     new 538dc8e67d4 branch-4.2: [fix](filecache) Disable file cache LRU dump 
by default #69099 (#69140)
538dc8e67d4 is described below

commit 538dc8e67d4542809337256df284d3d6b09fbef2
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Oct 16 09:23:17 2026 +0800

    branch-4.2: [fix](filecache) Disable file cache LRU dump by default #69099 
(#69140)
    
    Cherry-picked from #69099
    
    Co-authored-by: Xin Liao <[email protected]>
---
 be/src/common/config.cpp                               |  5 ++++-
 be/src/common/config.h                                 |  1 +
 be/test/io/cache/block_file_cache_test_lru_dump.cpp    | 10 +++++++++-
 be/test/io/cache/cache_lru_dumper_test.cpp             |  6 ++++++
 regression-test/suites/demo_p0/test_lru_persist.groovy |  3 ++-
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index c9a4880d12b..bd9eff1e435 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -1315,7 +1315,10 @@ DEFINE_mInt64(file_cache_background_ttl_gc_batch, 
"1000");
 DEFINE_mInt64(file_cache_background_lru_dump_interval_ms, "60000");
 // dump queue only if the queue update specific times through several dump 
intervals
 DEFINE_mInt64(file_cache_background_lru_dump_update_cnt_threshold, "1000");
-DEFINE_mInt64(file_cache_background_lru_dump_tail_record_num, "5000000");
+// Disabled by default. The restored LRU order can be worse than no order at 
all: restored blocks
+// are put at the cold end while blocks missing from the dump are appended to 
the hot end, and the
+// restore itself can overflow the bounded LRU log queue and drop the hottest 
part of the dump.
+DEFINE_mInt64(file_cache_background_lru_dump_tail_record_num, "0");
 DEFINE_mInt64(file_cache_background_lru_log_queue_max_size, "500000");
 DEFINE_mInt64(file_cache_background_lru_log_replay_interval_ms, "1");
 DEFINE_mBool(enable_evaluate_shadow_queue_diff, "false");
diff --git a/be/src/common/config.h b/be/src/common/config.h
index 2adfb8c8988..70c6519efef 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -1343,6 +1343,7 @@ DECLARE_Int32(file_cache_downloader_thread_num_max);
 DECLARE_mInt64(file_cache_background_lru_dump_interval_ms);
 // dump queue only if the queue update specific times through several dump 
intervals
 DECLARE_mInt64(file_cache_background_lru_dump_update_cnt_threshold);
+// max LRU entries to dump for each queue, 0 disables LRU log recording, 
dumping and restoring
 DECLARE_mInt64(file_cache_background_lru_dump_tail_record_num);
 DECLARE_mInt64(file_cache_background_lru_log_queue_max_size);
 DECLARE_mInt64(file_cache_background_lru_log_replay_interval_ms);
diff --git a/be/test/io/cache/block_file_cache_test_lru_dump.cpp 
b/be/test/io/cache/block_file_cache_test_lru_dump.cpp
index 3a581d77c76..a44e3f6585c 100644
--- a/be/test/io/cache/block_file_cache_test_lru_dump.cpp
+++ b/be/test/io/cache/block_file_cache_test_lru_dump.cpp
@@ -28,10 +28,13 @@ TEST_F(BlockFileCacheTest, 
test_lru_log_record_replay_dump_restore) {
     config::file_cache_background_lru_dump_interval_ms = 3000;
     config::file_cache_background_lru_dump_update_cnt_threshold = 0;
     const auto old_replay_interval_ms = 
config::file_cache_background_lru_log_replay_interval_ms;
-    Defer defer {[old_replay_interval_ms] {
+    const auto old_tail_record_num = 
config::file_cache_background_lru_dump_tail_record_num;
+    Defer defer {[old_replay_interval_ms, old_tail_record_num] {
         config::file_cache_background_lru_log_replay_interval_ms = 
old_replay_interval_ms;
+        config::file_cache_background_lru_dump_tail_record_num = 
old_tail_record_num;
     }};
     config::file_cache_background_lru_log_replay_interval_ms = 60 * 60 * 1000;
+    config::file_cache_background_lru_dump_tail_record_num = 5000000;
     if (fs::exists(cache_base_path)) {
         fs::remove_all(cache_base_path);
     }
@@ -409,6 +412,11 @@ TEST_F(BlockFileCacheTest, 
test_lru_duplicate_queue_entry_restore) {
     config::file_cache_enter_disk_resource_limit_mode_percent = 99;
     config::file_cache_background_lru_dump_interval_ms = 3000;
     config::file_cache_background_lru_dump_update_cnt_threshold = 0;
+    const auto old_tail_record_num = 
config::file_cache_background_lru_dump_tail_record_num;
+    Defer defer {[old_tail_record_num] {
+        config::file_cache_background_lru_dump_tail_record_num = 
old_tail_record_num;
+    }};
+    config::file_cache_background_lru_dump_tail_record_num = 5000000;
     if (fs::exists(cache_base_path)) {
         fs::remove_all(cache_base_path);
     }
diff --git a/be/test/io/cache/cache_lru_dumper_test.cpp 
b/be/test/io/cache/cache_lru_dumper_test.cpp
index e49a142bb2c..98eb56d424f 100644
--- a/be/test/io/cache/cache_lru_dumper_test.cpp
+++ b/be/test/io/cache/cache_lru_dumper_test.cpp
@@ -131,6 +131,12 @@ TEST_F(CacheLRUDumperTest, test_remove_lru_dump_files) {
 }
 
 TEST_F(CacheLRUDumperTest, test_dump_and_restore_queue) {
+    const auto old_tail_record_num = 
config::file_cache_background_lru_dump_tail_record_num;
+    Defer defer {[old_tail_record_num] {
+        config::file_cache_background_lru_dump_tail_record_num = 
old_tail_record_num;
+    }};
+    config::file_cache_background_lru_dump_tail_record_num = 5000000;
+
     LRUQueue src_queue;
     std::string queue_name = "normal";
 
diff --git a/regression-test/suites/demo_p0/test_lru_persist.groovy 
b/regression-test/suites/demo_p0/test_lru_persist.groovy
index 7d8c84e6f55..f9fe35c070c 100644
--- a/regression-test/suites/demo_p0/test_lru_persist.groovy
+++ b/regression-test/suites/demo_p0/test_lru_persist.groovy
@@ -54,7 +54,8 @@ suite('test_lru_persist', 'docker') {
     options.beConfigs += ['enable_file_cache=true', 
'enable_java_support=false', 
'file_cache_enter_disk_resource_limit_mode_percent=99',
                           'file_cache_background_lru_dump_interval_ms=2000', 
'file_cache_background_lru_log_replay_interval_ms=500',
                           'disable_auto_compaction=true', 
'file_cache_enter_need_evict_cache_in_advance_percent=99',
-                          
'file_cache_background_lru_dump_update_cnt_threshold=0'
+                          
'file_cache_background_lru_dump_update_cnt_threshold=0',
+                          
'file_cache_background_lru_dump_tail_record_num=5000000'
                         ]
 
     // run another docker


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

Reply via email to