jiajunwang commented on a change in pull request #348: Adding the configuration 
items of the WAGED rebalancer.
URL: https://github.com/apache/helix/pull/348#discussion_r307863842
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/model/ResourceConfig.java
 ##########
 @@ -775,17 +794,38 @@ private void validate() {
           }
         }
       }
+
+      if (_partitionCapacityMap != null) {
+        if (_partitionCapacityMap.keySet().stream()
+            .noneMatch(partition -> partition.equals(DEFAULT_PARTITION_KEY))) {
+          throw new IllegalArgumentException(
+              "Partition capacity is configured without the DEFAULT 
capacity!");
+        }
+        if (_partitionCapacityMap.values().stream()
+            .anyMatch(capacity -> capacity.values().stream().anyMatch(value -> 
value < 0))) {
+          throw new IllegalArgumentException(
+              "Partition capacity is configured with negative capacity 
value!");
+        }
+      }
     }
 
     public ResourceConfig build() {
       // TODO: Reenable the validation in the future when ResourceConfig is 
ready.
       // validate();
 
-      return new ResourceConfig(_resourceId, _monitorDisabled, _numPartitions, 
_stateModelDefRef,
 
 Review comment:
   Discussed with Yi offline. I have converted to be the preferred style.
   However, the builder pattern used in the resource config is still not the 
recommended way. We will fix it in the future.

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

Reply via email to