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

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


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

commit f42bb06db131441fa0e3499f447c0bfbcdc70529
Author: yiguolei <[email protected]>
AuthorDate: Tue Jul 14 17:27:56 2026 +0800

    [bugfix](memory) should force refresh workload group's config when memlimit 
changed (#65542)
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 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 0c0bdf5f74c..51d15297699 100644
--- a/be/src/runtime/workload_group/workload_group.cpp
+++ b/be/src/runtime/workload_group/workload_group.cpp
@@ -154,38 +154,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