From 644781f95dbf6d69bd6673b4986ea31c64f9b193 Mon Sep 17 00:00:00 2001 From: Zou Xinyi Date: Thu, 9 Jan 2025 19:22:50 +0800 Subject: [PATCH] 1 --- .../runtime/workload_group/workload_group.cpp | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/be/src/runtime/workload_group/workload_group.cpp b/be/src/runtime/workload_group/workload_group.cpp index d68a69cc98135d..65c5cb7499fd33 100644 --- a/be/src/runtime/workload_group/workload_group.cpp +++ b/be/src/runtime/workload_group/workload_group.cpp @@ -213,56 +213,44 @@ int64_t WorkloadGroup::gc_memory(int64_t need_free_mem, RuntimeProfile* profile, if (need_free_mem <= 0) { return 0; } + // Disable the default WorkloadGroup `normal` memory GC, for users who have not configured WorkloadGroup, + // will not notice the existence of WorkloadGroup `normal` in memory usage. + if (_name == "normal" && _enable_memory_overcommit) { + return 0; + } int64_t used_memory = memory_used(); int64_t freed_mem = 0; - std::string cancel_str = ""; - if (is_minor_gc) { - cancel_str = fmt::format( - "MinorGC kill overcommit query, wg id:{}, name:{}, used:{}, limit:{}, " - "backend:{}.", - _id, _name, MemCounter::print_bytes(used_memory), - MemCounter::print_bytes(_memory_limit), BackendOptions::get_localhost()); - } else { - if (_enable_memory_overcommit) { - cancel_str = fmt::format( - "FullGC release wg overcommit mem, wg id:{}, name:{}, " - "used:{},limit:{},backend:{}.", - _id, _name, MemCounter::print_bytes(used_memory), - MemCounter::print_bytes(_memory_limit), BackendOptions::get_localhost()); - } else { - cancel_str = fmt::format( - "GC wg for hard limit, wg id:{}, name:{}, used:{}, limit:{}, " - "backend:{}.", - _id, _name, MemCounter::print_bytes(used_memory), - MemCounter::print_bytes(_memory_limit), BackendOptions::get_localhost()); - } - } + std::string cancel_str = fmt::format( + "WorkloadGroup memory exceed limit, id:{}, name:{}, used:{}, limit:{}, " + "backend:{}.", + _id, _name, MemCounter::print_bytes(used_memory), + MemCounter::print_bytes(_memory_limit), BackendOptions::get_localhost()); auto cancel_top_overcommit_str = [cancel_str](int64_t mem_consumption, const std::string& label) { return fmt::format( - "{} cancel top memory overcommit tracker <{}> consumption {}. details:{}, " + "{} cancel top memory overcommit tracker <{}> consumption {}. {}, " "Execute " "again after enough memory, details see be.INFO.", cancel_str, label, MemCounter::print_bytes(mem_consumption), - GlobalMemoryArbitrator::process_limit_exceeded_errmsg_str()); + GlobalMemoryArbitrator::process_mem_log_str()); }; auto cancel_top_usage_str = [cancel_str](int64_t mem_consumption, const std::string& label) { return fmt::format( - "{} cancel top memory used tracker <{}> consumption {}. details:{}, Execute " + "{} cancel top memory used tracker <{}> consumption {}. {}, Execute " "again " "after enough memory, details see be.INFO.", cancel_str, label, MemCounter::print_bytes(mem_consumption), - GlobalMemoryArbitrator::process_soft_limit_exceeded_errmsg_str()); + GlobalMemoryArbitrator::process_mem_log_str()); }; LOG(INFO) << fmt::format( - "[MemoryGC] work load group start gc, id:{} name:{}, memory limit: {}, used: {}, " + "[MemoryGC] WorkloadGroup start gc, id:{} name:{}, memory limit: {}, used: {}, " "need_free_mem: {}.", _id, _name, _memory_limit, used_memory, need_free_mem); Defer defer {[&]() { LOG(INFO) << fmt::format( - "[MemoryGC] work load group finished gc, id:{} name:{}, memory limit: {}, " + "[MemoryGC] WorkloadGroup finished gc, id:{} name:{}, memory limit: {}, " "used: " "{}, need_free_mem: {}, freed memory: {}.", _id, _name, _memory_limit, used_memory, need_free_mem, freed_mem);