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


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudEnv.java:
##########
@@ -339,7 +339,7 @@ public void changeCloudCluster(String clusterName, 
ConnectContext ctx) throws Dd
         } catch (UserException e) {
             throw new DdlException(e.getMessage(), e.getMysqlErrorCode());
         }
-        ctx.setCloudCluster(clusterName);
+        ctx.setCloudCluster(clusterName, 
getCloudSystemInfoService().getCloudClusterIdByName(clusterName));

Review Comment:
   [P1] Forward the stable compute-group ID to the master
   
   This captures the ID on the observer, but `FEOpExecutor` serializes only the 
compute-group name in `TMasterOpRequest`, and 
`FrontendServiceImpl.createForwardContext()` restores it with the one-argument 
setter, leaving the ID null. A normal forwarded `INSERT` can therefore 
serialize name A, race with A → A2, and fail dummy-location planning on the 
master even though id-A still exists. Forward an optional ID with name-only 
fallback for rolling upgrades, and cover an observer → master rename race.



##########
fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java:
##########
@@ -1052,6 +1052,10 @@ public List<Backend> getBackendsByClusterName(final 
String clusterName) {
     }
 
     public List<Backend> getBackendsByClusterId(final String clusterId) {
+        CloudComputeGroupMeta computeGroup = getComputeGroupById(clusterId);

Review Comment:
   [P1] Keep virtual child references stable across rename
   
   The physical fast path is ID-based, but a virtual ID still resolves through 
the policy's physical child names. Renaming an active child updates that 
physical cluster's name/mapping without atomically rewriting the virtual policy 
reference, so `getPhysicalCluster()` sees the active child as missing and can 
attempt a spurious failover and locally route to standby even when the 
control-plane switch is rejected (or return the obsolete name and fail lookup). 
Store/resolve virtual children by stable ID, cascade the rename atomically, or 
reject renaming a referenced child; add a real active-child rename test that 
asserts no switch attempt, local flip, or standby routing.



##########
fe/fe-core/src/test/java/org/apache/doris/cloud/load/CloudBrokerLoadJobTest.java:
##########
@@ -0,0 +1,58 @@
+// 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.cloud.load;
+
+import org.apache.doris.catalog.Env;
+import org.apache.doris.cloud.system.CloudSystemInfoService;
+import org.apache.doris.common.jmockit.Deencapsulation;
+import org.apache.doris.qe.AutoCloseConnectContext;
+import org.apache.doris.qe.ConnectContext;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+
+import java.util.Map;
+
+public class CloudBrokerLoadJobTest {
+    @Test
+    public void testBuildConnectContextKeepsStableComputeGroupIdAfterRename() 
throws Exception {
+        CloudSystemInfoService systemInfoService = 
Mockito.mock(CloudSystemInfoService.class);
+        
Mockito.when(systemInfoService.getClusterNameByClusterId("compute-group-id"))
+                .thenReturn("renamed-compute-group");
+        Env env = Mockito.mock(Env.class);

Review Comment:
   [P1] Initialize the mocked Env before invoking the helper
   
   This mock leaves `getInternalCatalog()` unstubbed. `buildConnectContext()` 
creates a fresh `ConnectContext` and calls `setEnv(Env.getCurrentEnv())`; 
`ConnectContext.setEnv()` immediately evaluates 
`env.getInternalCatalog().getName()`, so Mockito returns null and this test 
throws `NullPointerException` before either assertion. Stub a usable 
`InternalCatalog` and its name (as `StreamLoadHandlerTest` does), or use a 
fully initialized test `Env`, then rerun FE UT.



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