wangbo commented on code in PR #24052:
URL: https://github.com/apache/doris/pull/24052#discussion_r1320941273


##########
be/src/agent/cgroup_cpu_ctl.cpp:
##########
@@ -0,0 +1,118 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "agent/cgroup_cpu_ctl.h"
+
+namespace doris {
+
+Status CgroupCpuCtl::init() {
+    _sys_cgroup_root_path = config::sys_cgroup_root_path;
+    if (_sys_cgroup_root_path.back() != '/') {
+        _sys_cgroup_root_path = _sys_cgroup_root_path + "/";
+    }
+    _doris_cgroup_home_name = config::doris_cgroup_home_name;
+    if (access(_sys_cgroup_root_path.c_str(), F_OK) != 0) {
+        LOG(ERROR) << "sys cgroup path not exists, path=" << 
_sys_cgroup_root_path;
+        return Status::InternalError("sys cgroup path {} not exists.", 
_sys_cgroup_root_path);
+    }
+    return Status::OK();
+}
+
+void CgroupCpuCtl::update_cpu_hard_limit(int cpu_hard_limit) {
+    if (!_init_succ) {
+        return;
+    }
+    std::lock_guard<std::shared_mutex> w_lock(_lock_mutex);
+    if (_cpu_hard_limit != cpu_hard_limit) {
+        _cpu_hard_limit = cpu_hard_limit;
+        modify_cg_cpu_hard_limit_no_lock(cpu_hard_limit);

Review Comment:
   cpu hard limit should be modify when a query arrives with workload group.
   So if modify cgroup failed, query should not be blocked or failed.
   This exception should be  handled when user find workload group may not work 
and see be.INFO



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to