Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
f692979
Build the framework for NORMAL queue hot-cold data separation.
xuchenhao Sep 5, 2025
eae0439
Fixed the bug where metrics are displaying incorrectly.
xuchenhao Sep 8, 2025
a8d746a
Added the hits_ratio_1m metric.
xuchenhao Sep 9, 2025
adcdc68
Add a unit test case.
xuchenhao Sep 9, 2025
a685bb8
Support cold-hot separation for try_reserve_from_other_queue.
xuchenhao Sep 12, 2025
f1e3fd8
Update .idea/vcs.xml
xuchenhao Oct 24, 2025
ea1e5fe
Merge remote-tracking branch 'origin/master' into normal_queue_cold_h…
xuchenhao Oct 24, 2025
c92e788
Update vcs.xml
xuchenhao Oct 24, 2025
16ef3a8
Format the code.
xuchenhao Oct 24, 2025
e7f2027
Merge remote-tracking branch 'origin/normal_queue_cold_hot_seperation…
xuchenhao Oct 24, 2025
6718df6
Format the code.
xuchenhao Oct 24, 2025
870f0a4
Format the code.
xuchenhao Oct 24, 2025
3581305
Update config.cpp.
xuchenhao Oct 24, 2025
4105506
Merge branch 'master' into normal_queue_cold_hot_seperation
xuchenhao Oct 25, 2025
dc8ec30
Update vcs.xml
xuchenhao Oct 25, 2025
a313c66
Merge branch 'master' into normal_queue_cold_hot_seperation
xuchenhao Oct 25, 2025
736a475
Merge branch 'master' into normal_queue_cold_hot_seperation
xuchenhao Oct 26, 2025
23bebfa
Merge branch 'master' into normal_queue_cold_hot_seperation
xuchenhao Oct 27, 2025
99ced55
Update ut cases.
xuchenhao Oct 27, 2025
4339bc6
Update rt cases.
xuchenhao Oct 27, 2025
5483674
Merge branch 'master' into normal_queue_cold_hot_seperation
xuchenhao Oct 27, 2025
c2ec6d1
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 27, 2025
e3e6f4e
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 27, 2025
e5006c0
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 27, 2025
2db5db7
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 27, 2025
c8b2852
Format the code.
xuchenhao Oct 28, 2025
d34cd7f
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 28, 2025
06adccc
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 28, 2025
def5145
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 28, 2025
9e61cf2
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 28, 2025
3432c18
Merge branch 'master' into normal_queue_cold_hot_separation
wenzhenghu Oct 28, 2025
67c7d87
Add config normal_queue_cold_time_ms.
xuchenhao Oct 29, 2025
f32fb56
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 29, 2025
6482315
Merge remote-tracking branch 'origin/normal_queue_cold_hot_separation…
xuchenhao Oct 29, 2025
5ca78e6
Format the code.
xuchenhao Oct 29, 2025
24ae73e
Update ut cases.
xuchenhao Oct 30, 2025
b68957c
Format the code.
xuchenhao Oct 30, 2025
ee3dbb1
Update config name.
xuchenhao Oct 30, 2025
f9abf0c
Format the code.
xuchenhao Oct 30, 2025
1d155f6
Update rt cases.
xuchenhao Oct 30, 2025
3fa733b
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Oct 30, 2025
d0744fb
Merge branch 'master' into normal_queue_cold_hot_separation
wenzhenghu Nov 3, 2025
e756b9c
Merge branch 'master' into normal_queue_cold_hot_separation
wenzhenghu Nov 5, 2025
e4fd7fb
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 6, 2025
54b3446
Format the code.
xuchenhao Nov 6, 2025
12940ea
Update fs_file_cache_storage.cpp.
xuchenhao Nov 6, 2025
4173616
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 6, 2025
90c476c
Add new FileCacheType.
xuchenhao Nov 6, 2025
04c5ff3
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 6, 2025
a5f87fa
Add new FileCacheType.
xuchenhao Nov 6, 2025
39e6067
Merge remote-tracking branch 'origin/normal_queue_cold_hot_separation…
xuchenhao Nov 6, 2025
2c597f9
Add new FileCacheType.
xuchenhao Nov 6, 2025
b2a332b
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 7, 2025
0fd26e6
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 7, 2025
af39440
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 11, 2025
d863ca9
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 11, 2025
7e38d80
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 11, 2025
fc56957
Enhance LRU mode compatibility.
xuchenhao Nov 12, 2025
08671aa
Format the code.
xuchenhao Nov 12, 2025
e99840e
Format the code.
xuchenhao Nov 12, 2025
4ccb5d9
Update rt cases.
xuchenhao Nov 12, 2025
388cd4a
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 12, 2025
ba66db3
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Nov 13, 2025
8c58afe
Update rt cases.
xuchenhao Nov 13, 2025
f954688
Update config.cpp.
xuchenhao Nov 13, 2025
273f2ad
Limit the range of file_cache_2qlru_cold_blocks_percent.
xuchenhao Nov 13, 2025
1587b55
Update config.cpp.
xuchenhao Nov 13, 2025
3787b5d
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Dec 18, 2025
cd7d2e1
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Dec 18, 2025
ec3552e
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Dec 19, 2025
3727092
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Dec 19, 2025
b50ba81
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Dec 21, 2025
f03c295
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Dec 22, 2025
071d444
Update comment to clarify configurable range source
wenzhenghu Jan 26, 2026
44aa78c
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Jan 27, 2026
10eebee
Update block_file_cache_test.cpp
xuchenhao Jan 27, 2026
784ec0a
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Jan 29, 2026
84aa2ac
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Jan 29, 2026
b912226
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Jan 30, 2026
33e5b24
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Jan 30, 2026
ec81797
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Feb 2, 2026
cb62551
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 2, 2026
f976844
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 2, 2026
79ac7bb
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 3, 2026
00d69eb
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 4, 2026
2784e43
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 4, 2026
a2ccecd
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 5, 2026
09ff325
Merge branch 'master' into normal_queue_cold_hot_separation
xuchenhao Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,12 @@ DEFINE_mInt64(file_cache_background_lru_dump_update_cnt_threshold, "1000");
DEFINE_mInt64(file_cache_background_lru_dump_tail_record_num, "5000000");
DEFINE_mInt64(file_cache_background_lru_log_replay_interval_ms, "1000");
DEFINE_mBool(enable_evaluate_shadow_queue_diff, "false");
DEFINE_mBool(enable_file_cache_normal_queue_2qlru, "false");
DEFINE_Int32(file_cache_2qlru_cold_blocks_percent, "20");
// Inspired by MySQL's innodb_old_blocks_time, defines the time window (in milliseconds)
// during which accesses to a cold block do not promote it to the hot queue.
// Reference: https://dev.mysql.com/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_old_blocks_time
DEFINE_mInt32(file_cache_2qlru_cold_blocks_promotion_ms, "1000");

DEFINE_mBool(file_cache_enable_only_warm_up_idx, "false");

Expand Down
3 changes: 3 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,9 @@ DECLARE_mInt64(file_cache_background_lru_dump_update_cnt_threshold);
DECLARE_mInt64(file_cache_background_lru_dump_tail_record_num);
DECLARE_mInt64(file_cache_background_lru_log_replay_interval_ms);
DECLARE_mBool(enable_evaluate_shadow_queue_diff);
DECLARE_mBool(enable_file_cache_normal_queue_2qlru);
DECLARE_Int32(file_cache_2qlru_cold_blocks_percent);
DECLARE_mInt32(file_cache_2qlru_cold_blocks_promotion_ms);

DECLARE_mBool(file_cache_enable_only_warm_up_idx);

Expand Down
192 changes: 166 additions & 26 deletions be/src/io/cache/block_file_cache.cpp

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions be/src/io/cache/block_file_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ struct FileBlockCell {
std::optional<LRUQueue::Iterator> queue_iterator;

mutable int64_t atime {0};

void update_atime() const {
atime = std::chrono::duration_cast<std::chrono::seconds>(
atime = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now().time_since_epoch())
.count();
}
Expand Down Expand Up @@ -408,7 +409,7 @@ class BlockFileCache {

void update_block_lru(FileBlockSPtr block, std::lock_guard<std::mutex>& cache_lock);

void use_cell(const FileBlockCell& cell, FileBlocks* result, bool not_need_move,
void use_cell(FileBlockCell& cell, FileBlocks* result, bool not_need_move,
std::lock_guard<std::mutex>& cache_lock);

bool try_reserve_for_lru(const UInt128Wrapper& hash, QueryFileCacheContextPtr query_context,
Expand Down Expand Up @@ -539,6 +540,7 @@ class BlockFileCache {
LRUQueue _normal_queue;
LRUQueue _disposable_queue;
LRUQueue _ttl_queue;
LRUQueue _cold_normal_queue;

// keys for async remove
RecycleFileCacheKeys _recycle_keys;
Expand All @@ -555,19 +557,21 @@ class BlockFileCache {
std::shared_ptr<bvar::Status<size_t>> _cur_ttl_cache_lru_queue_element_count_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_normal_queue_element_count_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_normal_queue_cache_size_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_cold_normal_queue_element_count_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_cold_normal_queue_cache_size_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_index_queue_element_count_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_index_queue_cache_size_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_disposable_queue_element_count_metrics;
std::shared_ptr<bvar::Status<size_t>> _cur_disposable_queue_cache_size_metrics;
std::array<std::shared_ptr<bvar::Adder<size_t>>, 4> _queue_evict_size_metrics;
std::array<std::shared_ptr<bvar::Adder<size_t>>, 5> _queue_evict_size_metrics;
std::shared_ptr<bvar::Adder<size_t>> _total_read_size_metrics;
std::shared_ptr<bvar::Adder<size_t>> _total_hit_size_metrics;
std::shared_ptr<bvar::Adder<size_t>> _total_evict_size_metrics;
std::shared_ptr<bvar::Adder<size_t>> _gc_evict_bytes_metrics;
std::shared_ptr<bvar::Adder<size_t>> _gc_evict_count_metrics;
std::shared_ptr<bvar::Adder<size_t>> _evict_by_time_metrics_matrix[4][4];
std::shared_ptr<bvar::Adder<size_t>> _evict_by_size_metrics_matrix[4][4];
std::shared_ptr<bvar::Adder<size_t>> _evict_by_self_lru_metrics_matrix[4];
std::shared_ptr<bvar::Adder<size_t>> _evict_by_time_metrics_matrix[5][5];
std::shared_ptr<bvar::Adder<size_t>> _evict_by_size_metrics_matrix[5][5];
std::shared_ptr<bvar::Adder<size_t>> _evict_by_self_lru_metrics_matrix[5];
std::shared_ptr<bvar::Adder<size_t>> _evict_by_try_release;

std::shared_ptr<bvar::Window<bvar::Adder<size_t>>> _num_hit_blocks_5m;
Expand Down
6 changes: 5 additions & 1 deletion be/src/io/cache/cache_lru_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ void CacheLRUDumper::restore_queue(LRUQueue& queue, const std::string& queue_nam
ctx.cache_type = FileCacheType::NORMAL;
} else if (queue_name == "disposable") {
ctx.cache_type = FileCacheType::DISPOSABLE;
} else if (queue_name == "cold_normal") {
ctx.cache_type = config::enable_file_cache_normal_queue_2qlru
? FileCacheType::COLD_NORMAL
: FileCacheType::NORMAL;
} else {
LOG_WARNING("unknown queue type for lru restore, skip");
DCHECK(false);
Expand All @@ -498,7 +502,7 @@ void CacheLRUDumper::restore_queue(LRUQueue& queue, const std::string& queue_nam
};

void CacheLRUDumper::remove_lru_dump_files() {
std::vector<std::string> queue_names = {"disposable", "index", "normal", "ttl"};
std::vector<std::string> queue_names = {"disposable", "index", "normal", "ttl", "cold_normal"};
for (const auto& queue_name : queue_names) {
std::string filename =
fmt::format("{}/lru_dump_{}.tail", _mgr->_cache_base_path, queue_name);
Expand Down
5 changes: 5 additions & 0 deletions be/src/io/cache/file_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ uint64_t FileBlock::get_caller_id() {
return id;
}

void FileBlock::set_cache_type(FileCacheType new_type) {
std::lock_guard block_lock(_mutex);
_key.meta.type = new_type;
}

uint64_t FileBlock::get_or_set_downloader() {
std::lock_guard block_lock(_mutex);

Expand Down
2 changes: 2 additions & 0 deletions be/src/io/cache/file_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class FileBlock {

FileCacheType cache_type() const { return _key.meta.type; }

void set_cache_type(FileCacheType new_type);

int64_t tablet_id() const { return _key.meta.tablet_id; }

void set_tablet_id(int64_t id) { _key.meta.tablet_id = id; }
Expand Down
31 changes: 29 additions & 2 deletions be/src/io/cache/file_cache_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ std::string cache_type_to_surfix(FileCacheType type) {
return "";
case FileCacheType::TTL:
return "_ttl";
case FileCacheType::COLD_NORMAL:
return "_cold_normal";
}
return "";
}
Expand All @@ -47,6 +49,8 @@ FileCacheType surfix_to_cache_type(const std::string& str) {
return FileCacheType::DISPOSABLE;
} else if (str == "ttl") {
return FileCacheType::TTL;
} else if (str == "cold_normal") {
return FileCacheType::COLD_NORMAL;
}
DCHECK(false) << "The string is " << str;
return FileCacheType::DISPOSABLE;
Expand All @@ -61,6 +65,8 @@ FileCacheType string_to_cache_type(const std::string& str) {
return FileCacheType::DISPOSABLE;
} else if (str == "ttl") {
return FileCacheType::TTL;
} else if (str == "cold_normal") {
return FileCacheType::COLD_NORMAL;
}
DCHECK(false) << "The string is " << str;
return FileCacheType::NORMAL;
Expand All @@ -75,6 +81,8 @@ std::string cache_type_to_string(FileCacheType type) {
return "normal";
case FileCacheType::TTL:
return "ttl";
case FileCacheType::COLD_NORMAL:
return "cold_normal";
}
DCHECK(false) << "unknown type: " << type;
return "normal";
Expand All @@ -90,7 +98,9 @@ std::string FileCacheSettings::to_string() const {
<< ", index_queue_elements: " << index_queue_elements
<< ", ttl_queue_size: " << ttl_queue_size << ", ttl_queue_elements: " << ttl_queue_elements
<< ", query_queue_size: " << query_queue_size
<< ", query_queue_elements: " << query_queue_elements << ", storage: " << storage;
<< ", query_queue_elements: " << query_queue_elements
<< ", cold_query_queue_size: " << cold_query_queue_size
<< ", cold_query_queue_elements: " << cold_query_queue_elements << ", storage: " << storage;
return ss.str();
}

Expand Down Expand Up @@ -125,6 +135,20 @@ FileCacheSettings get_file_cache_settings(size_t capacity, size_t max_query_cach
settings.query_queue_elements =
std::max(settings.query_queue_size / settings.max_file_block_size,
REMOTE_FS_OBJECTS_CACHE_DEFAULT_ELEMENTS);

if (config::enable_file_cache_normal_queue_2qlru) {
size_t normal_queue_per_size = settings.query_queue_size / 100;
size_t normal_queue_per_elements = settings.query_queue_elements / 100;

settings.cold_query_queue_size =
normal_queue_per_size * config::file_cache_2qlru_cold_blocks_percent;
settings.cold_query_queue_elements =
normal_queue_per_elements * config::file_cache_2qlru_cold_blocks_percent;

settings.query_queue_size -= settings.cold_query_queue_size;
settings.query_queue_elements -= settings.cold_query_queue_elements;
}

settings.storage = storage;
return settings;
}
Expand All @@ -136,7 +160,10 @@ std::string UInt128Wrapper::to_string() const {
FileBlocksHolderPtr FileCacheAllocatorBuilder::allocate_cache_holder(size_t offset, size_t size,
int64_t tablet_id) const {
CacheContext ctx;
ctx.cache_type = _expiration_time == 0 ? FileCacheType::NORMAL : FileCacheType::TTL;
ctx.cache_type = _expiration_time == 0 ? (config::enable_file_cache_normal_queue_2qlru
? FileCacheType::COLD_NORMAL
: FileCacheType::NORMAL)
: FileCacheType::TTL;
ctx.expiration_time = _expiration_time;
ctx.is_cold_data = _is_cold_data;
ctx.tablet_id = tablet_id;
Expand Down
8 changes: 7 additions & 1 deletion be/src/io/cache/file_cache_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cstdint>
#include <vector>

#include "common/config.h"
#include "io/io_common.h"
#include "vec/common/uint128.h"

Expand All @@ -41,6 +42,7 @@ enum FileCacheType {
NORMAL = 1,
DISPOSABLE = 0,
TTL = 3,
COLD_NORMAL = 4,
};
std::string cache_type_to_surfix(FileCacheType type);
FileCacheType surfix_to_cache_type(const std::string& str);
Expand Down Expand Up @@ -129,6 +131,8 @@ struct FileCacheSettings {
size_t index_queue_elements {0};
size_t query_queue_size {0};
size_t query_queue_elements {0};
size_t cold_query_queue_size {0};
size_t cold_query_queue_elements {0};
size_t ttl_queue_size {0};
size_t ttl_queue_elements {0};
size_t max_file_block_size {0};
Expand Down Expand Up @@ -156,7 +160,9 @@ struct CacheContext {
} else if (io_context->is_disposable) {
cache_type = FileCacheType::DISPOSABLE;
} else {
cache_type = FileCacheType::NORMAL;
cache_type = doris::config::enable_file_cache_normal_queue_2qlru
? FileCacheType::COLD_NORMAL
: FileCacheType::NORMAL;
}
query_id = io_context->query_id ? *io_context->query_id : TUniqueId();
is_warmup = io_context->is_warmup;
Expand Down
3 changes: 2 additions & 1 deletion be/src/io/cache/fs_file_cache_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ Status FSFileCacheStorage::parse_filename_suffix_to_cache_type(
if (expiration_time > 0) {
*cache_type = FileCacheType::TTL;
} else if (*cache_type == FileCacheType::TTL && expiration_time == 0) {
*cache_type = FileCacheType::NORMAL;
*cache_type = config::enable_file_cache_normal_queue_2qlru ? FileCacheType::COLD_NORMAL
: FileCacheType::NORMAL;
}

if (!parsed) {
Expand Down
4 changes: 4 additions & 0 deletions be/src/io/cache/lru_queue_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ LRUQueue& LRUQueueRecorder::get_shadow_queue(FileCacheType type) {
return _shadow_normal_queue;
case FileCacheType::TTL:
return _shadow_ttl_queue;
case FileCacheType::COLD_NORMAL:
return _shadow_cold_normal_queue;
default:
LOG(WARNING) << "invalid shadow queue type";
DCHECK(false);
Expand All @@ -122,6 +124,8 @@ CacheLRULogQueue& LRUQueueRecorder::get_lru_log_queue(FileCacheType type) {
return _normal_lru_log_queue;
case FileCacheType::TTL:
return _ttl_lru_log_queue;
case FileCacheType::COLD_NORMAL:
return _cold_normal_lru_log_queue;
default:
LOG(WARNING) << "invalid lru log queue type";
DCHECK(false);
Expand Down
3 changes: 3 additions & 0 deletions be/src/io/cache/lru_queue_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class LRUQueueRecorder {
_lru_queue_update_cnt_from_last_dump[FileCacheType::NORMAL] = 0;
_lru_queue_update_cnt_from_last_dump[FileCacheType::INDEX] = 0;
_lru_queue_update_cnt_from_last_dump[FileCacheType::TTL] = 0;
_lru_queue_update_cnt_from_last_dump[FileCacheType::COLD_NORMAL] = 0;
}
void record_queue_event(FileCacheType type, CacheLRULogType log_type, const UInt128Wrapper hash,
const size_t offset, const size_t size);
Expand All @@ -74,11 +75,13 @@ class LRUQueueRecorder {
LRUQueue _shadow_normal_queue;
LRUQueue _shadow_disposable_queue;
LRUQueue _shadow_ttl_queue;
LRUQueue _shadow_cold_normal_queue;

CacheLRULogQueue _ttl_lru_log_queue;
CacheLRULogQueue _index_lru_log_queue;
CacheLRULogQueue _normal_lru_log_queue;
CacheLRULogQueue _disposable_lru_log_queue;
CacheLRULogQueue _cold_normal_lru_log_queue;

std::unordered_map<FileCacheType, size_t> _lru_queue_update_cnt_from_last_dump;

Expand Down
10 changes: 9 additions & 1 deletion be/src/olap/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,15 @@ Status parse_conf_cache_paths(const std::string& config_path, std::vector<CacheP
if (total_size < 0 || (config::enable_file_cache_query_limit && query_limit_bytes < 0)) {
return Status::InvalidArgument("total_size or query_limit should not less than zero");
}

if (config::enable_file_cache_normal_queue_2qlru) {
// The configurable range is inspired by MySQL's innodb_old_blocks_pct
// Reference: https://dev.mysql.com/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_old_blocks_pct
if (config::file_cache_2qlru_cold_blocks_percent < 5 ||
config::file_cache_2qlru_cold_blocks_percent > 95) {
}
return Status::InvalidArgument(
"file_cache_2qlru_cold_blocks_percent must be between 5 and 95.");
}
// percent
auto get_percent_value = [&](const std::string& key, size_t& percent) {
auto& value = map.FindMember(key.c_str())->value;
Expand Down
Loading