narendly commented on a change in pull request #511: More strict partition 
weight validation while creating the cluster model.
URL: https://github.com/apache/helix/pull/511#discussion_r336163339
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/AssignableReplica.java
 ##########
 @@ -151,22 +152,24 @@ public static String generateReplicaKey(String 
resourceName, String partitionNam
 
     Map<String, Integer> partitionCapacity = capacityMap.get(partitionName);
     if (partitionCapacity == null) {
-      partitionCapacity = 
capacityMap.get(ResourceConfig.DEFAULT_PARTITION_KEY);
+      partitionCapacity =
+          capacityMap.getOrDefault(ResourceConfig.DEFAULT_PARTITION_KEY, new 
HashMap<>());
     }
-    if (partitionCapacity == null) {
-      LOG.warn("The capacity usage of the specified partition {} is not 
configured in the Resource"
-          + " Config {}. No default partition capacity is configured either. 
Will proceed with"
-          + " empty capacity configuration.", partitionName, 
resourceConfig.getResourceName());
-      partitionCapacity = new HashMap<>();
+
+    for (Map.Entry<String, Integer> capacityEntry : 
clusterConfig.getDefaultPartitionWeightMap()
+        .entrySet()) {
+      partitionCapacity.putIfAbsent(capacityEntry.getKey(), 
capacityEntry.getValue());
     }
 
     List<String> requiredCapacityKeys = 
clusterConfig.getInstanceCapacityKeys();
 
 Review comment:
   Would it be better to just iterate over `requiredCapacityKeys` in the first 
place starting in line 159?

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


With regards,
Apache Git Services

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

Reply via email to