Copilot commented on code in PR #62125:
URL: https://github.com/apache/doris/pull/62125#discussion_r3036293059


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java:
##########
@@ -319,30 +312,6 @@ private long getBackendIdImpl(String clusterId) throws 
ComputeGroupException {
 
         if (Config.enable_cloud_multi_replica) {
             int indexRand = rand.nextInt(Config.cloud_replica_num);
-            int coldReadRand = rand.nextInt(100);
-            boolean allowColdRead = coldReadRand < 
Config.cloud_cold_read_percent;
-            initMemClusterToBackends();
-            boolean replicaEnough = memClusterToBackends.get(clusterId) != null
-                    && memClusterToBackends.get(clusterId).size() > indexRand;
-
-            long backendId = -1;
-            if (replicaEnough) {
-                backendId = memClusterToBackends.get(clusterId).get(indexRand);
-            }
-
-            if (!replicaEnough && !allowColdRead && 
primaryClusterToBackend.containsKey(clusterId)) {
-                backendId = primaryClusterToBackend.get(clusterId);
-            }
-
-            if (backendId > 0) {
-                Backend be = Env.getCurrentSystemInfo().getBackend(backendId);
-                if (be != null && be.isQueryAvailable()) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("backendId={} ", backendId);
-                    }
-                    return backendId;
-                }
-            }
 
             List<Long> res = hashReplicaToBes(clusterId, false, 
Config.cloud_replica_num);
             if (res.size() < indexRand + 1) {

Review Comment:
   `enable_cloud_multi_replica` path now returns a backend ID from 
`hashReplicaToBes(...)` without validating that the selected backend is 
query-available. `hashReplicaToBes` filters by `isAlive()` / heartbeat time, 
not `isQueryAvailable()`, so this can route queries to an unavailable backend. 
Consider filtering by `be.isQueryAvailable()` (like `hashReplicaToBe`) or 
checking availability for the chosen ID and falling back to another candidate 
(or primary/secondary mapping) before returning.



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