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


Reply via email to