smengcl commented on code in PR #11523:
URL: https://github.com/apache/ozone/pull/11523#discussion_r4268126890
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/net/NetworkTopologyImpl.java:
##########
@@ -811,7 +830,15 @@ public <N extends Node> List<N> sortByDistanceCost(Node
reader,
for (List<N> list : tree.values()) {
if (list != null) {
shuffleOperation.accept(list);
- ret.addAll(list);
+ if (sortGroupByRack) {
+ Map<String, List<N>> racks = new LinkedHashMap<>();
+ for (N node : list) {
+ racks.computeIfAbsent(node.getNetworkLocation(), k -> new
ArrayList<>()).add(node);
Review Comment:
`getNetworkLocation()` identifies the nodegroup, not the rack, when SCM uses
the bundled `network-topology-nodegroup.xml`. With a client at `/r3/ng1`, all
three datanodes at `/r1/ng1`, `/r2/ng1`, and `/r1/ng2` have the same distance.
This code puts them in three separate groups, so the shuffled order can remain
`/r1/ng1 → /r2/ng1 → /r1/ng2`. The routing cost is 18 instead of 16 when the
two `/r1` nodes stay together. `RatisHelper.getRoutingTable()` uses this order
for datastream writes, so enabling the new option still leaves the avoidable
rack crossing in this supported topology. Please derive the rack group from the
topology/schema and cover two different nodegroups in one rack.
--
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]