narendly commented on a change in pull request #1043:
URL: https://github.com/apache/helix/pull/1043#discussion_r433002690
##########
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:
@xyuanlu
Let's use a Map to declare?
And what you said about LinkedHashMap is true, but Map is a higher-level
construct (interface) and LinkedHashMap is an implementation. Even if you
wanted a LinkedHashMap instance, how do you guarantee that the map has the
right order? If you want to be 100% sure about the order, you have two options:
1. Make it crystal clear that the user must pass in ordered map (TreeMap or
LinkedHashMap)
2. do your own sorting internally.
With that said, what you said about using LinkedHashMap for declaration
implies that maybe we should review the difference between declaration and
implementation. Here's a helpful explanation:
https://stackoverflow.com/questions/11715485/what-is-the-difference-between-declaration-and-definition-in-java
----------------------------------------------------------------
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]