chia7712 commented on code in PR #15745:
URL: https://github.com/apache/kafka/pull/15745#discussion_r1588469427


##########
core/src/test/java/kafka/test/ClusterConfig.java:
##########
@@ -55,14 +56,21 @@ public class ClusterConfig {
     private final Map<Integer, Map<String, String>> 
perBrokerOverrideProperties;
 
     @SuppressWarnings("checkstyle:ParameterNumber")
-    private ClusterConfig(Type type, int brokers, int controllers, String 
name, boolean autoStart,
+    private ClusterConfig(Type type, int brokers, int controllers, int 
disksPerBroker, String name, boolean autoStart,
                   SecurityProtocol securityProtocol, String listenerName, File 
trustStoreFile,
                   MetadataVersion metadataVersion, Map<String, String> 
serverProperties, Map<String, String> producerProperties,
                   Map<String, String> consumerProperties, Map<String, String> 
adminClientProperties, Map<String, String> saslServerProperties,
                   Map<String, String> saslClientProperties, Map<Integer, 
Map<String, String>> perBrokerOverrideProperties) {
+        if (brokers < 0) {
+            throw new IllegalArgumentException("Number of brokers must be 
greater or equal to zero.");
+        }
+        if (controllers <= 0 || disksPerBroker <= 0) {

Review Comment:
   My point was "controllers can be zero in zk case", so `ClusterConfig` should 
not throw exception. Hence, we should have following checks.
   ```java
           // do fail fast. the following values are invalid for both zk and 
kraft modes.
           if (brokers < 0) throw new IllegalArgumentException("Number of 
brokers must be greater or equal to zero.");
           if (controllers < 0) throw new IllegalArgumentException("Number of 
controller must be greater or equal to zero.");
           if (disksPerBroker <= 0) throw new IllegalArgumentException("Number 
of disks must be greater than zero.");
   ```



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

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to