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 2021/02/24 23:30:16 UTC

[GitHub] [helix] jiajunwang commented on a change in pull request #1652: Add TopStateUsage constraint to Waged

jiajunwang commented on a change in pull request #1652:
URL: https://github.com/apache/helix/pull/1652#discussion_r582362522



##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/ConstraintBasedAlgorithmFactory.java
##########
@@ -41,8 +41,9 @@
       put(PartitionMovementConstraint.class.getSimpleName(), 2f);
       put(InstancePartitionsCountConstraint.class.getSimpleName(), 1f);
       put(ResourcePartitionAntiAffinityConstraint.class.getSimpleName(), 1f);
-      put(ResourceTopStateAntiAffinityConstraint.class.getSimpleName(), 3f);
-      put(MaxCapacityUsageInstanceConstraint.class.getSimpleName(), 5f);
+      put(ResourceTopStateAntiAffinityConstraint.class.getSimpleName(), 0f);

Review comment:
       Let's just remove the ResourceTopStateAntiAffinityConstraint from this list. 

##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/AssignableNode.java
##########
@@ -226,13 +233,16 @@ public int getAssignedReplicaCount() {
    * For example, if the current node usage is {CPU: 0.9, MEM: 0.4, DISK: 0.6}. Then this call shall
    * return 0.9.
    * @param newUsage the proposed new additional capacity usage.
+   * @param isTopState whether the returned utilization is for top state partitions only
    * @return The highest utilization number of the node among all the capacity category.
    */
-  public float getProjectedHighestUtilization(Map<String, Integer> newUsage) {
+  public float getProjectedHighestUtilization(Map<String, Integer> newUsage, boolean isTopState) {

Review comment:
       Using boolean input to switch branch is not a clear design overall.
   Please add another method for getProjectedHighestTopStateUtilization(). To minimize duplicate code, we can have a private method that contains the common part. We can put Map<String, Integer> remainingCapacity as an input parameter for the private method, so that the later logic will be the same for both public methods.

##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/AssignableNode.java
##########
@@ -311,13 +321,17 @@ private void addToAssignmentRecord(AssignableReplica replica) {
     }
   }
 
-  private void updateRemainingCapacity(String capacityKey, int usage) {
-    if (!_remainingCapacity.containsKey(capacityKey)) {
-      //if the capacityKey belongs to replicas does not exist in the instance's capacity,
-      // it will be treated as if it has unlimited capacity of that capacityKey
-      return;
+  private void updateRemainingCapacity(Map<String, Integer> usedCapacity, boolean isRelease,

Review comment:
       Same here.




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



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