lmr3796 commented on a change in pull request #9435: URL: https://github.com/apache/kafka/pull/9435#discussion_r535019810
########## File path: core/src/main/scala/kafka/server/KafkaApis.scala ########## @@ -1243,19 +1244,30 @@ class KafkaApis(val requestChannel: RequestChannel, topicResponses } else { val nonExistentTopics = topics.diff(topicResponses.map(_.name).toSet) - val responsesForNonExistentTopics = nonExistentTopics.map { topic => + val responsesForNonExistentTopics = nonExistentTopics.flatMap { topic => if (isInternal(topic)) { val topicMetadata = createInternalTopic(topic) - if (topicMetadata.errorCode == Errors.COORDINATOR_NOT_AVAILABLE.code) - metadataResponseTopic(Errors.INVALID_REPLICATION_FACTOR, topic, true, util.Collections.emptyList()) - else - topicMetadata + List( + if (topicMetadata.errorCode == Errors.COORDINATOR_NOT_AVAILABLE.code) + metadataResponseTopic(Errors.INVALID_REPLICATION_FACTOR, topic, true, util.Collections.emptyList()) + else + topicMetadata + ) + } else if (isFetchAllMetadata) { + // 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. + // + // However, in previous versions, UNKNOWN_TOPIC_OR_PARTITION won't happen on fetch all metadata, + // so, for backward-compatibility, we need to skip these not founds during fetch all metadata here. + Nil Review comment: @chia7712 Thanks, you're right. Just updated accordingly and rebased latest trunk ---------------------------------------------------------------- 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