narendly commented on a change in pull request #1043:
URL: https://github.com/apache/helix/pull/1043#discussion_r433520034
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/topology/Topology.java
##########
@@ -212,123 +186,106 @@ private static Node cloneTree(Node root, Map<Node,
Integer> newNodeWeight, Set<N
return newRoot;
}
- /**
- * Creates a tree representing the cluster structure using default cluster
topology definition
- * (i,e no topology definition given and no domain id set).
- */
- private Node createClusterTreeWithDefaultTopologyDef() {
+ private Node createClusterTree() {
// root
Node root = new Node();
root.setName("root");
root.setId(computeId("root"));
root.setType(Types.ROOT.name());
- for (String ins : _allInstances) {
- InstanceConfig config = _instanceConfigMap.get(ins);
- Map<String, String> pathValueMap = new HashMap<>();
- if (_topologyAwareEnabled) {
- String zone = config.getZoneId();
+ for (String instance : _allInstances) {
+ InstanceConfig insConfig = _instanceConfigMap.get(instance);
+ LinkedHashMap<String, String> instanceTopologyMap = new
LinkedHashMap<>();
Review comment:
Yes, what you said about using the interface is on point.
I understand where you are coming from - you want to make it explicit that
the parameter that's being passed in is ordered. But let's revisit what I said
above - making the declaration LinkedHashMap does not help you in that case.
LinkedHashMap's ordering is not deterministic. It does not enforce the right
ordering you need in the map. So you aren't really enforcing anything there
other than the map will have some order.
If you want to enforce some sort of ordering of elements, you should sort
internally. Say you need it sorted by alphabetical order, then you should
convert this map into a TreeMap.
Alternatively, stating that the topology map must be ordered in some way is
also acceptable in JavaDoc, but in that case, the right thing to do is to be
able to detect if the ordering has a problem, be able to throw an exception of
some sort, alerting the user.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]