xyuanlu commented on code in PR #2944:
URL: https://github.com/apache/helix/pull/2944#discussion_r1796063300


##########
helix-core/src/main/java/org/apache/helix/controller/common/CapacityNode.java:
##########
@@ -98,8 +148,38 @@ public int getCurrentlyAssigned() {
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    
sb.append("##########\nname=").append(_id).append("\nassigned:").append(_currentlyAssigned)
-        .append("\ncapacity:").append(_capacity);
+    sb.append("##########\nname=").append(_instanceName).append("\nassigned:")
+        
.append(_currentlyAssigned).append("\ncapacity:").append(_capacity).append("\nlogicalId:")
+        .append(_logicaId).append("\nfaultZone:").append(_faultZone);
     return sb.toString();
   }
+
+  @Override
+  public int compareTo(CapacityNode o) {
+    if (_logicaId != null) {
+      return _logicaId.compareTo(o.getLogicalId());
+    }
+    return _instanceName.compareTo(o.getInstanceName());
+  }
+
+  /**
+   * Computes the fault zone id based on the domain and fault zone type when 
topology is enabled.
+   * For example, when
+   * the domain is "zone=2, instance=testInstance" and the fault zone type is 
"zone", this function
+   * returns "2".
+   * If cannot find the fault zone type, this function leaves the fault zone 
id as the instance name.

Review Comment:
   In terms of swap, using logic id will make the swap in/out instances in the 
same fault zone. But I also agree that this should align with other 
rebalancers' behavior. 
   What do you think about if we add a todo and consider changing both places 
later? 



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