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

 ##########
 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:
   Builder pattern usually only has one line for the method
   ```
   return new ResourceConfig(this);
   ```

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

Reply via email to