github-actions[bot] commented on code in PR #68833:
URL: https://github.com/apache/doris/pull/68833#discussion_r4230380348


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudInstanceStatusChecker.java:
##########
@@ -516,32 +522,43 @@ private void handleNewVirtualComputeGroup(Cloud.ClusterPB 
cluster, List<Cloud.Cl
     }
 
     private void checkSubClusters(List<String> subClusterNames, 
Cloud.ClusterPB cluster,
-                                  List<Cloud.ClusterPB> computeClustersInPB) {
+                                  Map<String, Cloud.ClusterPB> 
computeClustersByName) {
+        boolean allSubClustersExist = true;
         for (String subClusterName : subClusterNames) {
-            if (cloudSystemInfoService.getCloudClusterIdByName(subClusterName) 
== null) {
-                handleFailedSync(cluster, subClusterName, computeClustersInPB);
-                continue;
+            Cloud.ClusterPB subClusterInMs = 
computeClustersByName.get(subClusterName);
+            String subClusterIdInFe = 
cloudSystemInfoService.getCloudClusterIdByName(subClusterName);
+            boolean sameSubClusterInFe = subClusterInMs != null
+                    && subClusterInMs.getClusterId().equals(subClusterIdInFe);
+            // Empty compute groups exist only in MS because FE builds its 
mapping from BE nodes.
+            boolean emptySubClusterOnlyInMs = subClusterInMs != null && 
subClusterInMs.getNodesCount() == 0
+                    && subClusterIdInFe == null;
+            if (!sameSubClusterInFe && !emptySubClusterOnlyInMs) {
+                allSubClustersExist = false;
+                handleFailedSync(cluster, subClusterName, subClusterInMs, 
subClusterIdInFe);
             }
-            // CloudClusterChecker find sub compute group
-            lastFailedSyncTimeMap.remove(cluster.getClusterName());
+        }
+        if (allSubClustersExist) {
+            lastFailedSyncTimeMap.remove(cluster.getClusterId());
         }
     }
 
     private void handleFailedSync(Cloud.ClusterPB cluster, String 
subClusterName,
-                                  List<Cloud.ClusterPB> computeClustersInPB) {
-        if (!lastFailedSyncTimeMap.containsKey(cluster.getClusterName())) {
-            lastFailedSyncTimeMap.put(cluster.getClusterName(), 
System.currentTimeMillis());
+                                  Cloud.ClusterPB subClusterInMs, String 
subClusterIdInFe) {
+        if (!lastFailedSyncTimeMap.containsKey(cluster.getClusterId())) {
+            lastFailedSyncTimeMap.put(cluster.getClusterId(), 
System.currentTimeMillis());
         } else {
-            List<String> computeGroupsInPb = computeClustersInPB.stream()
-                    
.map(Cloud.ClusterPB::getClusterName).collect(Collectors.toList());
-            if (computeGroupsInPb.contains(subClusterName)) {
+            if (subClusterInMs == null) {

Review Comment:
   [P3] Distinguish a stale FE mapping from two missing mappings. After MS 
renames physical `p` while a VCG still references `p`, the separate 
CloudClusterChecker may not yet have removed FE's `p -> oldId` entry. 
`subClusterInMs` is then null but `subClusterIdInFe` is non-null, so this 
branch incorrectly logs that both FE and MS cannot find `p`. Include the 
residual FE ID when it exists. This is distinct from the existing 
MS-present/FE-wrong-ID 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: [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