cmccabe commented on code in PR #15986:
URL: https://github.com/apache/kafka/pull/15986#discussion_r1619514531


##########
raft/src/main/java/org/apache/kafka/raft/QuorumConfig.java:
##########
@@ -199,6 +206,34 @@ private static Map<Integer, InetSocketAddress> 
parseVoterConnections(
         return voterMap;
     }
 
+    public static InetSocketAddress parseBootstrapServer(String 
bootstrapServer) {
+        String host = Utils.getHost(bootstrapServer);
+        if (host == null) {
+            throw new ConfigException(
+                String.format(
+                    "Failed to parse host name from {} for the configuration 
{}. Each " +
+                    "entry should be in the form \"{host}:{port}\"",
+                    bootstrapServer,
+                    QUORUM_BOOTSTRAP_SERVERS_CONFIG
+                )
+            );
+        }
+
+        Integer port = Utils.getPort(bootstrapServer);
+        if (port == null) {
+            throw new ConfigException(
+                String.format(
+                    "Failed to parse host port from {} for the configuration 
{}. Each " +
+                    "entry should be in the form \"{host}:{port}\"",
+                    bootstrapServer,
+                    QUORUM_BOOTSTRAP_SERVERS_CONFIG
+                )
+            );
+        }
+
+        return InetSocketAddress.createUnresolved(host, port);

Review Comment:
   I think it's a mistake to resolve hostnames as part of configuration 
validation. Just treat them as strings.
   
   Otherwise you could end up not being able to start Kafka because 1 out of 3 
hostnames in your bootstrap list could not be resolved (because of a DNS 
problem or whatever)
   
   Resolve a hostname when you're actually using it, not before.



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