jiajunwang commented on a change in pull request #520: Refactor soft 
constraints to simply the algorithm and fix potential issues.
URL: https://github.com/apache/helix/pull/520#discussion_r339248452
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/PartitionMovementConstraint.java
 ##########
 @@ -83,14 +77,20 @@ NormalizeFunction getNormalizeFunction() {
     return assignment.get(resourceName).getReplicaMap(new 
Partition(partitionName));
   }
 
-  private float calculateAssignmentScale(AssignableNode node, 
AssignableReplica replica,
+  private double calculateAssignmentScale(AssignableNode node, 
AssignableReplica replica,
       Map<String, String> instanceToStateMap) {
     String instanceName = node.getInstanceName();
     if (!instanceToStateMap.containsKey(instanceName)) {
       return 0;
     } else {
-      return 
(instanceToStateMap.get(instanceName).equals(replica.getReplicaState()) ? 1
-          : ALLOCATION_MATCH_FACTOR);
+      return 
(instanceToStateMap.get(instanceName).equals(replica.getReplicaState()) ? 1 :
+          ALLOCATION_MATCH_FACTOR);
     }
   }
+
+  @Override
+  protected NormalizeFunction getNormalizeFunction() {
+    // PartitionMovementConstraint already scale the score properly.
+    return (score) -> score;
 
 Review comment:
   Sounds good.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to