lmr3796 commented on a change in pull request #9435:
URL: https://github.com/apache/kafka/pull/9435#discussion_r533153634



##########
File path: core/src/main/scala/kafka/server/KafkaApis.scala
##########
@@ -1250,13 +1251,23 @@ class KafkaApis(val requestChannel: RequestChannel,
             metadataResponseTopic(Errors.INVALID_REPLICATION_FACTOR, topic, 
true, util.Collections.emptyList())
           else
             topicMetadata
-        } else if (allowAutoTopicCreation && config.autoCreateTopicsEnable) {
+        } else if (!isFetchAllMetadata && allowAutoTopicCreation && 
config.autoCreateTopicsEnable) {
+          // KAFKA-10606: If this request is to get metadata for all topics, 
auto topic creation should not be allowed
+          // The special handling is necessary on broker side because 
allowAutoTopicCreation is hard coded to true
+          // for backward compatibility on client side.
           createTopic(topic, config.numPartitions, 
config.defaultReplicationFactor)
         } else {
           metadataResponseTopic(Errors.UNKNOWN_TOPIC_OR_PARTITION, topic, 
false, util.Collections.emptyList())

Review comment:
       @ijuma I slightly changed it (and rebased latest) so the processing is a 
branch in the middle about `isFetchAllMetadata`.
   
   It's still a `map` and `filter` structure because I don't want to sacrifice 
the readability, but it's handled in the middle instead of at the returning 
statement, which I think is more elegant and readable than the original version.
   
   Let me know what you think!




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