morningman commented on code in PR #16533: URL: https://github.com/apache/doris/pull/16533#discussion_r1103931880
########## fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java: ########## @@ -49,6 +49,8 @@ public class BeSelectionPolicy { public boolean preferComputeNode = false; public int candidateNum = Integer.MAX_VALUE; + public List<String> preLocations = new ArrayList<>(); Review Comment: better name it `preferLocations`, `pre` always means `previous` or `prefix` ########## fe/fe-core/src/main/java/org/apache/doris/planner/EsScanNode.java: ########## @@ -231,39 +212,23 @@ private List<TScanRangeLocations> getShardLocations() throws UserException { LOG.debug("partition prune finished, unpartitioned index [{}], " + "partitioned index [{}]", String.join(",", unPartitionedIndices), String.join(",", partitionedIndices)); } - int size = backendList.size(); - int beIndex = random.nextInt(size); List<TScanRangeLocations> result = Lists.newArrayList(); for (EsShardPartitions indexState : selectedIndex) { for (List<EsShardRouting> shardRouting : indexState.getShardRoutings().values()) { // get backends - Set<Backend> colocatedBes = Sets.newHashSet(); - int numBe = Math.min(3, size); List<TNetworkAddress> shardAllocations = new ArrayList<>(); + List<String> preLocations = new ArrayList<>(); for (EsShardRouting item : shardRouting) { shardAllocations.add(item.getHttpAddress()); + preLocations.add(item.getHttpAddress().getHostname()); } - Collections.shuffle(shardAllocations, random); - for (TNetworkAddress address : shardAllocations) { - colocatedBes.addAll(backendMap.get(address.getHostname())); - } - boolean usingRandomBackend = colocatedBes.size() == 0; - List<Backend> candidateBeList = Lists.newArrayList(); - if (usingRandomBackend) { - for (int i = 0; i < numBe; ++i) { - candidateBeList.add(backendList.get(beIndex++ % size)); - } - } else { - candidateBeList.addAll(colocatedBes); - Collections.shuffle(candidateBeList); - } - - // Locations + BackendPolicy backendPolicy = new BackendPolicy(); Review Comment: The `BackendPolicy` is `preferComputeNode` by default, which may be confusing for other developer. I think we should rename the `BackendPolicy` or explicitly set `preferComputeNode()` -- 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