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

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


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 0605796d8d9 branch-4.1: [bugfix](memory) should force refresh workload 
group's config when memlimit changed #65542 (#65593)
0605796d8d9 is described below

commit 0605796d8d99beee622396473524f899f7259c64
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 15 11:52:11 2026 +0800

    branch-4.1: [bugfix](memory) should force refresh workload group's config 
when memlimit changed #65542 (#65593)
    
    Cherry-picked from #65542
    
    Co-authored-by: yiguolei <[email protected]>
---
 be/src/runtime/workload_group/workload_group.cpp | 56 ++++++++++--------------
 1 file changed, 24 insertions(+), 32 deletions(-)

diff --git a/be/src/runtime/workload_group/workload_group.cpp 
b/be/src/runtime/workload_group/workload_group.cpp
index fb70b203f82..c7dcac23a1e 100644
--- a/be/src/runtime/workload_group/workload_group.cpp
+++ b/be/src/runtime/workload_group/workload_group.cpp
@@ -156,38 +156,30 @@ void WorkloadGroup::check_and_update(const 
WorkloadGroupInfo& wg_info) {
     if (UNLIKELY(wg_info.id != _id)) {
         return;
     }
-    {
-        std::shared_lock<std::shared_mutex> rl {_mutex};
-        if (LIKELY(wg_info.version <= _version)) {
-            return;
-        }
-    }
-    {
-        std::lock_guard<std::shared_mutex> wl {_mutex};
-        if (wg_info.version > _version) {
-            _name = wg_info.name;
-            _version = wg_info.version;
-            _min_cpu_percent = wg_info.min_cpu_percent;
-            _max_cpu_percent = wg_info.max_cpu_percent;
-            _memory_limit = wg_info.memory_limit;
-            _min_memory_percent = wg_info.min_memory_percent;
-            _max_memory_percent = wg_info.max_memory_percent;
-            _scan_thread_num = wg_info.scan_thread_num;
-            _max_remote_scan_thread_num = wg_info.max_remote_scan_thread_num;
-            _min_remote_scan_thread_num = wg_info.min_remote_scan_thread_num;
-            _memory_low_watermark = wg_info.memory_low_watermark;
-            _memory_high_watermark = wg_info.memory_high_watermark;
-            _scan_bytes_per_second = wg_info.read_bytes_per_second;
-            _remote_scan_bytes_per_second = 
wg_info.remote_read_bytes_per_second;
-            _total_query_slot_count = wg_info.total_query_slot_count;
-            _slot_mem_policy = wg_info.slot_mem_policy;
-            if (_max_memory_percent > 0) {
-                _min_memory_limit = static_cast<int64_t>(
-                        static_cast<double>(_memory_limit * 
_min_memory_percent) /
-                        _max_memory_percent);
-            }
-        } else {
-            return;
+    std::lock_guard<std::shared_mutex> wl {_mutex};
+    // In serverless mode, user may modify cgroup's memory limit directly and 
workload group's config
+    // is not changed. So that we should update workload group's config ignore 
version.
+    if (wg_info.version > _version ||
+        (wg_info.version == _version && _memory_limit != 
wg_info.memory_limit)) {
+        _name = wg_info.name;
+        _version = wg_info.version;
+        _min_cpu_percent = wg_info.min_cpu_percent;
+        _max_cpu_percent = wg_info.max_cpu_percent;
+        _memory_limit = wg_info.memory_limit;
+        _min_memory_percent = wg_info.min_memory_percent;
+        _max_memory_percent = wg_info.max_memory_percent;
+        _scan_thread_num = wg_info.scan_thread_num;
+        _max_remote_scan_thread_num = wg_info.max_remote_scan_thread_num;
+        _min_remote_scan_thread_num = wg_info.min_remote_scan_thread_num;
+        _memory_low_watermark = wg_info.memory_low_watermark;
+        _memory_high_watermark = wg_info.memory_high_watermark;
+        _scan_bytes_per_second = wg_info.read_bytes_per_second;
+        _remote_scan_bytes_per_second = wg_info.remote_read_bytes_per_second;
+        _total_query_slot_count = wg_info.total_query_slot_count;
+        _slot_mem_policy = wg_info.slot_mem_policy;
+        if (_max_memory_percent > 0) {
+            _min_memory_limit = static_cast<int64_t>(
+                    static_cast<double>(_memory_limit * _min_memory_percent) / 
_max_memory_percent);
         }
     }
 }


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

Reply via email to