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


##########
fe/fe-core/src/main/java/org/apache/doris/resource/computegroup/ComputeGroup.java:
##########
@@ -0,0 +1,102 @@
+// 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.
+
+package org.apache.doris.resource.computegroup;
+
+import org.apache.doris.system.Backend;
+import org.apache.doris.system.SystemInfoService;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ComputeGroup {
+
+    private static final Logger LOG = LogManager.getLogger(ComputeGroup.class);
+
+    // NOTE: Why need an invalid compute group
+    // invalid compute group is mainly used in local-mode(not cloud mode),
+    // it comes from invalid resource tag(UserPropertyMgr.getComputeGroup), 
when trying to find a resource tag
+    // by user, but the user has not a property(maybe user is invalid),
+    // so introduce an invalid compute group to cover this case.
+    // caller should deal the invalid compute case by case;
+    // eg, if routine load cant not find a valid compute group when finding 
Slot BE, it could find BE by replica's tag.
+    // some other case may throw an Exception.
+    public static final String INVALID_COMPUTE_GROUP_NAME = 
"_invalid_compute_group_name";
+
+    public static final ComputeGroup INVALID_COMPUTE_GROUP = new 
ComputeGroup(INVALID_COMPUTE_GROUP_NAME,
+            INVALID_COMPUTE_GROUP_NAME, null);
+
+    public static final String INVALID_COMPUTE_GROUP_ERR_MSG
+            = "can not find a valid compute group, please check whether 
current user is valid.";
+
+    protected SystemInfoService systemInfoService;
+
+    protected String id;
+
+    protected String name;
+
+    public ComputeGroup(String id, String name, SystemInfoService 
systemInfoService) {
+        this.id = id;
+        this.name = name;
+        this.systemInfoService = systemInfoService;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean containsBackend(String backendTag) {
+        checkInvalidComputeGroup();
+        return StringUtils.equals(this.name, backendTag);
+    }
+
+    public List<Backend> getBackendList() {
+        checkInvalidComputeGroup();
+        Set<String> cgSet = new HashSet<>();

Review Comment:
   原生构造器不行,入参只能是集合



-- 
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