[branch-2.1]refactor workload group cpu hard limit (#51278) (#51382)

pick #51278
This commit is contained in:
wangbo
2025-06-23 14:45:45 +08:00
committed by GitHub
parent d194014914
commit 347c1e1e63
8 changed files with 17 additions and 103 deletions

View File

@ -19,7 +19,6 @@ package org.apache.doris.resource.workloadgroup;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeNameFormat;
import org.apache.doris.common.Pair;
@ -535,10 +534,6 @@ public class WorkloadGroup implements Writable, GsonPostProcessable {
result.addRow(row);
}
public int getCpuHardLimitWhenCalSum() {
return cpuHardLimit == -1 ? 0 : cpuHardLimit;
}
public double getMemoryLimitPercentWhenCalSum() {
return memoryLimitPercent == -1 ? 0 : memoryLimitPercent;
}
@ -595,14 +590,6 @@ public class WorkloadGroup implements Writable, GsonPostProcessable {
if (memOvercommitStr != null) {
tWorkloadGroupInfo.setEnableMemoryOvercommit(Boolean.valueOf(memOvercommitStr));
}
// enable_cpu_hard_limit = true, using cpu hard limit
// enable_cpu_hard_limit = false, using cpu soft limit
tWorkloadGroupInfo.setEnableCpuHardLimit(Config.enable_cpu_hard_limit);
if (Config.enable_cpu_hard_limit && cpuHardLimit <= 0) {
LOG.warn("enable_cpu_hard_limit=true but cpuHardLimit value not illegal,"
+ "id=" + id + ",name=" + name);
}
String scanThreadNumStr = properties.get(SCAN_THREAD_NUM);
if (scanThreadNumStr != null) {

View File

@ -382,7 +382,6 @@ public class WorkloadGroupMgr extends MasterDaemon implements Writable, GsonPost
for (String newWgOneTag : newWgTagSet) {
double sumOfAllMemLimit = 0;
int sumOfAllCpuHardLimit = 0;
// 1 get sum value of all wg which has same tag without current wg
for (Map.Entry<Long, WorkloadGroup> entry : idToWorkloadGroup.entrySet()) {
@ -401,9 +400,6 @@ public class WorkloadGroupMgr extends MasterDaemon implements Writable, GsonPost
continue;
}
if (wg.getCpuHardLimitWhenCalSum() > 0) {
sumOfAllCpuHardLimit += wg.getCpuHardLimitWhenCalSum();
}
if (wg.getMemoryLimitPercentWhenCalSum() > 0) {
sumOfAllMemLimit += wg.getMemoryLimitPercentWhenCalSum();
}
@ -411,7 +407,6 @@ public class WorkloadGroupMgr extends MasterDaemon implements Writable, GsonPost
// 2 sum current wg value
sumOfAllMemLimit += newWg.getMemoryLimitPercentWhenCalSum();
sumOfAllCpuHardLimit += newWg.getCpuHardLimitWhenCalSum();
// 3 check total sum
if (sumOfAllMemLimit > 100.0 + 1e-6) {
@ -420,13 +415,6 @@ public class WorkloadGroupMgr extends MasterDaemon implements Writable, GsonPost
newWgTag.isPresent() ? newWgTag.get() : "")
+ " cannot be greater than 100.0%. current sum val:" + sumOfAllMemLimit);
}
if (sumOfAllCpuHardLimit > 100) {
throw new DdlException(
"sum of all workload group " + WorkloadGroup.CPU_HARD_LIMIT + " within tag " + (
newWgTag.isPresent()
? newWgTag.get() : "") + " can not be greater than 100% ");
}
}
}