Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
yiguolei committed Dec 26, 2024
1 parent abb2fbf commit a4bb0e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
5 changes: 1 addition & 4 deletions be/src/runtime/exec_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ class ExecEnv {
this->_routine_load_task_executor = r;
}
void set_wal_mgr(std::unique_ptr<WalManager>&& wm) { this->_wal_manager = wm; }
void set_dummy_lru_cache(std::unique_ptr<DummyLRUCache>&& dummy_lru_cache) {
this->_dummy_lru_cache = dummy_lru_cache;
}

void set_write_cooldown_meta_executors();
static void set_tracking_memory(bool tracking_memory) {
_s_tracking_memory.store(tracking_memory, std::memory_order_release);
Expand Down Expand Up @@ -331,7 +329,6 @@ class ExecEnv {
return _inverted_index_query_cache;
}
QueryCache* get_query_cache() { return _query_cache; }
DummyLRUCache* get_dummy_lru_cache() { return _dummy_lru_cache.get(); }

pipeline::RuntimeFilterTimerQueue* runtime_filter_timer_queue() {
return _runtime_filter_timer_queue;
Expand Down
12 changes: 5 additions & 7 deletions be/src/runtime/memory/lru_cache_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class LRUCachePolicy : public CachePolicy {
new ShardedLRUCache(type_string(type), capacity, lru_cache_type, num_shards,
element_count_capacity, is_lru_k));
} else {
CHECK(ExecEnv::GetInstance()->get_dummy_lru_cache());
_cache = ExecEnv::GetInstance()->get_dummy_lru_cache();
_cache = std::make_shared<doris::DummyLRUCache>();
}
_init_mem_tracker(lru_cache_type_string(lru_cache_type));
}
Expand All @@ -64,8 +63,7 @@ class LRUCachePolicy : public CachePolicy {
cache_value_time_extractor, cache_value_check_timestamp,
element_count_capacity, is_lru_k));
} else {
CHECK(ExecEnv::GetInstance()->get_dummy_lru_cache());
_cache = ExecEnv::GetInstance()->get_dummy_lru_cache();
_cache = std::make_shared<doris::DummyLRUCache>();
}
_init_mem_tracker(lru_cache_type_string(lru_cache_type));
}
Expand Down Expand Up @@ -157,7 +155,7 @@ class LRUCachePolicy : public CachePolicy {
std::lock_guard<std::mutex> l(_lock);
COUNTER_SET(_freed_entrys_counter, (int64_t)0);
COUNTER_SET(_freed_memory_counter, (int64_t)0);
if (_stale_sweep_time_s <= 0 || _cache == ExecEnv::GetInstance()->get_dummy_lru_cache()) {
if (_stale_sweep_time_s <= 0 || std::dynamic_pointer_cast<doris::DummyLRUCache>(_cache)) {
return;
}
if (exceed_prune_limit()) {
Expand Down Expand Up @@ -204,7 +202,7 @@ class LRUCachePolicy : public CachePolicy {
std::lock_guard<std::mutex> l(_lock);
COUNTER_SET(_freed_entrys_counter, (int64_t)0);
COUNTER_SET(_freed_memory_counter, (int64_t)0);
if (_cache == ExecEnv::GetInstance()->get_dummy_lru_cache()) {
if (std::dynamic_pointer_cast<doris::DummyLRUCache>(_cache)) {
return;
}
if ((force && mem_consumption() != 0) || exceed_prune_limit()) {
Expand Down Expand Up @@ -246,7 +244,7 @@ class LRUCachePolicy : public CachePolicy {
COUNTER_SET(_freed_entrys_counter, (int64_t)0);
COUNTER_SET(_freed_memory_counter, (int64_t)0);
COUNTER_SET(_cost_timer, (int64_t)0);
if (_cache == ExecEnv::GetInstance()->get_dummy_lru_cache()) {
if (std::dynamic_pointer_cast<doris::DummyLRUCache>(_cache)) {
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion be/test/testutil/run_all_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ int main(int argc, char** argv) {
doris::ExecEnv::GetInstance()->set_cache_manager(doris::CacheManager::create_global_instance());
doris::ExecEnv::GetInstance()->set_process_profile(
doris::ProcessProfile::create_global_instance());
doris::ExecEnv::GetInstance()->set_dummy_lru_cache(std::make_unique<doris::DummyLRUCache>());
doris::ExecEnv::GetInstance()->set_storage_page_cache(
doris::StoragePageCache::create_global_cache(1 << 30, 10, 0));
doris::ExecEnv::GetInstance()->set_segment_loader(new doris::SegmentLoader(1000, 1000));
Expand Down

0 comments on commit a4bb0e6

Please sign in to comment.