You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2019/10/02 19:16:00 UTC

[GitHub] [helix] jiajunwang commented on a change in pull request #500: Ensure backward compatibility of the WAGED rebalancer.

jiajunwang commented on a change in pull request #500: Ensure backward compatibility of the WAGED rebalancer.
URL: https://github.com/apache/helix/pull/500#discussion_r330725300
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/AssignableNode.java
 ##########
 @@ -290,36 +287,27 @@ private String computeFaultZone(ClusterConfig clusterConfig, InstanceConfig inst
       return zoneId == null ? instanceConfig.getInstanceName() : zoneId;
     } else {
       // Get the fault zone information from the complete topology definition.
-      String[] topologyDef = topologyStr.trim().split("/");
-      if (topologyDef.length == 0
-          || Arrays.stream(topologyDef).noneMatch(type -> type.equals(faultZoneType))) {
+      String[] topologyKeys = topologyStr.trim().split("/");
+      if (topologyKeys.length == 0 || Arrays.stream(topologyKeys)
+          .noneMatch(type -> type.equals(faultZoneType))) {
         throw new HelixException(
             "The configured topology definition is empty or does not contain the fault zone type.");
       }
 
       Map<String, String> domainAsMap = instanceConfig.getDomainAsMap();
-      if (domainAsMap == null) {
-        throw new HelixException(
-            String.format("The domain configuration of node %s is not configured", _instanceName));
-      } else {
-        StringBuilder faultZoneStringBuilder = new StringBuilder();
-        for (String key : topologyDef) {
-          if (!key.isEmpty()) {
-            if (domainAsMap.containsKey(key)) {
-              faultZoneStringBuilder.append(domainAsMap.get(key));
-              faultZoneStringBuilder.append('/');
-            } else {
-              throw new HelixException(String.format(
-                  "The domain configuration of node %s is not complete. Type %s is not found.",
-                  _instanceName, key));
-            }
-            if (key.equals(faultZoneType)) {
-              break;
-            }
+      StringBuilder faultZoneStringBuilder = new StringBuilder();
+      for (String key : topologyKeys) {
+        if (!key.isEmpty()) {
 
 Review comment:
   No for the input like this "/test/", the first item will be empty.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org