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


##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/WorkloadGroupMgr.java:
##########
@@ -219,27 +228,48 @@ public void createWorkloadGroup(String computeGroup, 
WorkloadGroup workloadGroup
     //  when create/alter workload group with same tag.
     //  when oldWg is not null it means caller is an alter stmt.
     private void checkGlobalUnlock(WorkloadGroup newWg, WorkloadGroup oldWg) 
throws DdlException {
+        // trim all properties
+        newWg.trimProperties();
         String newWgCg = newWg.getComputeGroup();
 
         int wgNumOfCurrentCg = 0;
-        boolean isAlterStmt = oldWg != null;
-        boolean isCreateStmt = !isAlterStmt;
+        boolean isCreateStmt = oldWg == null;
+        int sumOfMinCpuPercent = 0;
+        int sumOfMinMemoryPercent = 0;
+        ++ wgNumOfCurrentCg;
+        sumOfMinCpuPercent += newWg.getMinCpuPercent();
+        sumOfMinMemoryPercent += newWg.getMinMemoryPercent();
+
 
         // 1 get sum value of all wg which has same tag without current wg
         for (Map.Entry<Long, WorkloadGroup> entry : 
idToWorkloadGroup.entrySet()) {
             WorkloadGroup wg = entry.getValue();
-            String curWgCg = wg.getComputeGroup();
-
-            if (newWgCg.equals(entry.getValue().getComputeGroup())) {
-                wgNumOfCurrentCg++;
-            }
-
-            if (isAlterStmt && entry.getKey() == oldWg.getId()) {
+            if (!newWgCg.equalsIgnoreCase(wg.getComputeGroup())) {
                 continue;
             }
 
-            if (!newWgCg.equals(curWgCg)) {
-                continue;
+            if (newWg.getMinCpuPercent() > newWg.getMaxCpuPercent()) {

Review Comment:
   remove newWg's check outout for loop



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to