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/03/02 15:17:06 UTC

[GitHub] [kafka] hachikuji commented on a change in pull request #10240: KAFKA-12381: only return leader not available for internal topic creation

hachikuji commented on a change in pull request #10240:
URL: https://github.com/apache/kafka/pull/10240#discussion_r585651983



##########
File path: core/src/main/scala/kafka/server/AutoTopicCreationManager.scala
##########
@@ -275,7 +275,11 @@ class DefaultAutoTopicCreationManager(
       val validationError: Option[Errors] = if (!isValidTopicName(topic)) {
         Some(Errors.INVALID_TOPIC_EXCEPTION)
       } else if (!hasEnoughLiveBrokers(topic, aliveBrokers)) {
-        Some(Errors.INVALID_REPLICATION_FACTOR)
+        if (Topic.isInternal(topic)) {
+          Some(Errors.INVALID_REPLICATION_FACTOR)

Review comment:
       I cannot come up with a good reason why we should preserve this inconsistent handling. I traced back the origin of it to here: https://github.com/apache/kafka/commit/063d534c5160316cdf22e476d128e872a1412783. It looks to me like the intent is for the client to keep retrying until the topic can be created, which makes sense since we return `COORDINATOR_NOT_AVAILABLE` in response to `FindCoordinator` requests for the same case. However, `INVALID_REPLICATION_FACTOR` is a non-retriable error, so it's likely this was poorly understood at the time. I suggest that we return `LEADER_NOT_AVAILABLE` consistently.




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