alanlau28 commented on code in PR #22405:
URL: https://github.com/apache/kafka/pull/22405#discussion_r3639585979


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopicManager.java:
##########
@@ -575,17 +575,14 @@ private Set<String> createTopics(final Set<NewTopic> 
topicsToCreate,
                     log.error("Unexpected error during topic creation for 
{}.\n" +
                             "Error message was: {}", topicName, 
cause.toString());
 
-                    if (cause instanceof UnsupportedVersionException) {
-                        final String errorMessage = cause.getMessage();
-                        if (errorMessage != null &&
-                                errorMessage.startsWith("Creating topics with 
default partitions/replication factor are only supported in CreateTopicRequest 
version 4+")) {
-
-                            throw new StreamsException(String.format(
-                                    "Could not create topic %s, because 
brokers don't support configuration replication.factor=-1."
-                                            + " You can change the 
replication.factor config or upgrade your brokers to version 2.4 or newer to 
avoid this error.",
-                                    topicName)
-                            );
-                        }
+                    if (cause instanceof UnsupportedProtocolFieldException) {
+                        // An older broker rejected a field we rely on (e.g. 
the default
+                        // replication.factor=-1, which requires CreateTopics 
request version 4+).
+                        throw new StreamsException(String.format(
+                                "Could not create topic %s, because brokers 
don't support configuration replication.factor=-1."
+                                        + " You can change the 
replication.factor config or upgrade your brokers to version 2.4 or newer to 
avoid this error.",
+                                topicName)
+                        );

Review Comment:
   I think this file should be out of scope for the PR actually.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to