morningman commented on code in PR #16574:
URL: https://github.com/apache/doris/pull/16574#discussion_r1102668030


##########
fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java:
##########
@@ -1768,12 +1797,56 @@ public TScanRangeLocation 
selectBackendsByRoundRobin(List<TScanRangeLocation> lo
         return location;
     }
 
+    private void computeScanRangeAssignmentByConsistentHash(
+            ScanNode scanNode,
+            final List<TScanRangeLocations> locations,
+            FragmentScanRangeAssignment assignment,
+            Map<TNetworkAddress, Long> assignedBytesPerHost,
+            Map<TNetworkAddress, Long> replicaNumPerHost) throws Exception {
+        Collection<Backend> aliveBEs = 
idToBackend.values().stream().filter(SimpleScheduler::isAvailable)
+                .collect(Collectors.toList());
+        if (aliveBEs.isEmpty()) {
+            throw new UserException("No available backends");
+        }
+        int virtualNumber = Math.max(Math.min(512 / aliveBEs.size(), 32), 2);
+        ConsistentHash<TScanRangeLocations, Backend> consistentHash = new 
ConsistentHash<>(
+                Hashing.murmur3_128(), new ScanRangeHash(), new BackendHash(), 
aliveBEs, virtualNumber);
+        for (TScanRangeLocations scanRangeLocations : locations) {
+            TScanRangeLocation minLocation = 
scanRangeLocations.locations.get(0);
+            Backend backend = consistentHash.getNode(scanRangeLocations);
+            TNetworkAddress execHostPort = new 
TNetworkAddress(backend.getHost(), backend.getBePort());
+            this.addressToBackendID.put(execHostPort, backend.getId());
+            // Why only increase 1 in other implementations ?

Review Comment:
   TODO: because the file size of each scan range is same, so we can just use 1



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