You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/04/13 05:27:38 UTC

[GitHub] [kafka] mjsax opened a new pull request #10532: KAFKA-8531: Change default replication factor config

mjsax opened a new pull request #10532:
URL: https://github.com/apache/kafka/pull/10532


   Call for review @cadonna @ableegoldman 


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-819895175


   I started a quick KIP for this change -- will wait until the KIP is accepted before merging.


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-818449362


   As test against older broker versions, I started https://jenkins.confluent.io/job/system-test-kafka-branch-builder/4463/ -- maybe we need to update some system tests...


-- 
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:
users@infra.apache.org



[GitHub] [kafka] ableegoldman commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
ableegoldman commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-818967367


   > Was also wondering about a potential error message -- not sure atm what error message a user would get if they run against 2.3 brokers and if the error message would be clear. Should we do anything about it?
   
   Not sure either -- maybe you can use the soak test to spin up brokers on 2.2 against this PR and check out the error message + stack trace? I definitely think we should try to catch the error and log a more helpful error message (eg `in 3.0 we changed the default replication factor to -1 which requires brokers to be on 2.3+, please update your brokers or manually set the replication factor config`)


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax edited a comment on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax edited a comment on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-819834156


   Updated the PR.
   
   The log now show:
   ```
   [2021-04-14 14:10:02,176] ERROR stream-thread [main] Unexpected error during topic creation for streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition.
   Error message was: org.apache.kafka.common.errors.UnsupportedVersionException: Creating topics with default partitions/replication factor are only supported in CreateTopicRequest version 4+. The following topics need values for partitions and replicas: [streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition] (org.apache.kafka.streams.processor.internals.InternalTopicManager:451)
   [2021-04-14 14:10:02,183] ERROR stream-client [streams-wordcount-4b9ea556-bc49-4671-83e8-4d2adaba3677] Encountered the following exception during processing and the registered exception handler opted to SHUTDOWN_CLIENT. The streams client is going to shut down now.  (org.apache.kafka.streams.KafkaStreams:484)
   org.apache.kafka.streams.errors.StreamsException: Could not create topic streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition, 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.
   	at org.apache.kafka.streams.processor.internals.InternalTopicManager.makeReady(InternalTopicManager.java:459)
   [...]
   ```


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax commented on a change in pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax commented on a change in pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#discussion_r613600421



##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopicManager.java
##########
@@ -439,13 +440,34 @@ private String getBrokerSideConfigValue(final Config brokerSideTopicConfig,
                         final Throwable cause = executionException.getCause();
                         if (cause instanceof TopicExistsException) {
                             // This topic didn't exist earlier or its leader not known before; just retain it for next round of validation.
-                            log.info("Could not create topic {}. Topic is probably marked for deletion (number of partitions is unknown).\n" +
-                                "Will retry to create this topic in {} ms (to let broker finish async delete operation first).\n" +
-                                "Error message was: {}", topicName, retryBackOffMs, cause.toString());
+                            log.info(
+                                "Could not create topic {}. Topic is probably marked for deletion (number of partitions is unknown).\n"
+                                    +
+                                    "Will retry to create this topic in {} ms (to let broker finish async delete operation first).\n"
+                                    +
+                                    "Error message was: {}", topicName, retryBackOffMs,
+                                cause.toString());
                         } else {
                             log.error("Unexpected error during topic creation for {}.\n" +
                                 "Error message was: {}", topicName, cause.toString());
-                            throw new StreamsException(String.format("Could not create topic %s.", topicName), cause);
+
+                            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(

Review comment:
       Don't we log the error in L450 above already?




-- 
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:
users@infra.apache.org



[GitHub] [kafka] ableegoldman commented on a change in pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
ableegoldman commented on a change in pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#discussion_r613602328



##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopicManager.java
##########
@@ -439,13 +440,34 @@ private String getBrokerSideConfigValue(final Config brokerSideTopicConfig,
                         final Throwable cause = executionException.getCause();
                         if (cause instanceof TopicExistsException) {
                             // This topic didn't exist earlier or its leader not known before; just retain it for next round of validation.
-                            log.info("Could not create topic {}. Topic is probably marked for deletion (number of partitions is unknown).\n" +
-                                "Will retry to create this topic in {} ms (to let broker finish async delete operation first).\n" +
-                                "Error message was: {}", topicName, retryBackOffMs, cause.toString());
+                            log.info(
+                                "Could not create topic {}. Topic is probably marked for deletion (number of partitions is unknown).\n"
+                                    +
+                                    "Will retry to create this topic in {} ms (to let broker finish async delete operation first).\n"
+                                    +
+                                    "Error message was: {}", topicName, retryBackOffMs,
+                                cause.toString());
                         } else {
                             log.error("Unexpected error during topic creation for {}.\n" +
                                 "Error message was: {}", topicName, cause.toString());
-                            throw new StreamsException(String.format("Could not create topic %s.", topicName), cause);
+
+                            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(

Review comment:
       Ah, I was thinking of a log specific to this error but if we just log it at all that's good enough for me. Nevermind 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:
users@infra.apache.org



[GitHub] [kafka] ableegoldman commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
ableegoldman commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-819119565


   Yikes -- no, I think we definitely need to handle that ourselves. I don't think users will have any idea what that means -- for one thing they'll wonder why they're suddenly seeing it now, and probably report it as a bug if we don't explicitly tell them that we changed the default replication factor. For another, how are they supposed to know how to interpret `Creating topics with default partitions/replication factor are only supported in CreateTopicRequest version 4+` -- it doesn't even clearly state that the problem is older brokers, much less what version specifically the brokers need to be


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-818450072


   Was also wondering about a potential error message -- not sure atm what error message a user would get if they run against 2.3 brokers and if the error message would be clear. Should we do anything about it?


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax merged pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax merged pull request #10532:
URL: https://github.com/apache/kafka/pull/10532


   


-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-819103401


   The logs show the following error:
   ```
   [2021-04-13 15:52:17,685] ERROR stream-thread [main] Unexpected error during topic creation for streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition.
   Error message was: org.apache.kafka.common.errors.UnsupportedVersionException: Creating topics with default partitions/replication factor are only supported in CreateTopicRequest version 4+. The following topics need values for partitions and replicas: [streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition] (org.apache.kafka.streams.processor.internals.InternalTopicManager:446)
   [2021-04-13 15:52:17,687] ERROR stream-client [streams-wordcount-4b9ea556-bc49-4671-83e8-4d2adaba3677] Encountered the following exception during processing and the registered exception handler opted to SHUTDOWN_CLIENT. The streams client is going to shut down now.  (org.apache.kafka.streams.KafkaStreams:484)
   org.apache.kafka.streams.errors.StreamsException: Could not create topic streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition.
   ...
   Caused by: org.apache.kafka.common.errors.UnsupportedVersionException: Creating topics with default partitions/replication factor are only supported in CreateTopicRequest version 4+. The following topics need values for partitions and replicas: [streams-wordcount-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition]
   
   ```
   
   Do we think this would be sufficient? Or should we try to handle this specific `UnsupportedVersionException` explicitly?


-- 
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:
users@infra.apache.org



[GitHub] [kafka] ableegoldman commented on a change in pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
ableegoldman commented on a change in pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#discussion_r613592763



##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopicManager.java
##########
@@ -439,13 +440,34 @@ private String getBrokerSideConfigValue(final Config brokerSideTopicConfig,
                         final Throwable cause = executionException.getCause();
                         if (cause instanceof TopicExistsException) {
                             // This topic didn't exist earlier or its leader not known before; just retain it for next round of validation.
-                            log.info("Could not create topic {}. Topic is probably marked for deletion (number of partitions is unknown).\n" +
-                                "Will retry to create this topic in {} ms (to let broker finish async delete operation first).\n" +
-                                "Error message was: {}", topicName, retryBackOffMs, cause.toString());
+                            log.info(
+                                "Could not create topic {}. Topic is probably marked for deletion (number of partitions is unknown).\n"
+                                    +
+                                    "Will retry to create this topic in {} ms (to let broker finish async delete operation first).\n"
+                                    +
+                                    "Error message was: {}", topicName, retryBackOffMs,
+                                cause.toString());
                         } else {
                             log.error("Unexpected error during topic creation for {}.\n" +
                                 "Error message was: {}", topicName, cause.toString());
-                            throw new StreamsException(String.format("Could not create topic %s.", topicName), cause);
+
+                            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(

Review comment:
       nit: can we also log an error before throwing, possibly with the actual `cause` message

##########
File path: streams/src/test/java/org/apache/kafka/streams/processor/internals/InternalTopicManagerTest.java
##########
@@ -16,9 +16,11 @@
  */
 package org.apache.kafka.streams.processor.internals;
 
+import java.util.Collection;

Review comment:
       nit: import in the wrong place




-- 
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:
users@infra.apache.org



[GitHub] [kafka] mjsax commented on pull request #10532: KAFKA-8531: Change default replication factor config

Posted by GitBox <gi...@apache.org>.
mjsax commented on pull request #10532:
URL: https://github.com/apache/kafka/pull/10532#issuecomment-819834156


   Updated the PR.


-- 
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:
users@infra.apache.org