OmniaGM commented on code in PR #15968: URL: https://github.com/apache/kafka/pull/15968#discussion_r1644080966
########## core/src/main/scala/kafka/server/KafkaApis.scala: ########## @@ -608,40 +608,55 @@ class KafkaApis(val requestChannel: RequestChannel, } } - val unauthorizedTopicResponses = mutable.Map[TopicPartition, PartitionResponse]() - val nonExistingTopicResponses = mutable.Map[TopicPartition, PartitionResponse]() - val invalidRequestResponses = mutable.Map[TopicPartition, PartitionResponse]() - val authorizedRequestInfo = mutable.Map[TopicPartition, MemoryRecords]() + val unauthorizedTopicResponses = mutable.Map[TopicIdPartition, PartitionResponse]() + val nonExistingTopicResponses = mutable.Map[TopicIdPartition, PartitionResponse]() + val invalidRequestResponses = mutable.Map[TopicIdPartition, PartitionResponse]() + val authorizedRequestInfo = mutable.Map[TopicIdPartition, MemoryRecords]() + val topicIdToPartitionData = new mutable.ArrayBuffer[(TopicIdPartition, ProduceRequestData.PartitionProduceData)] + + produceRequest.data.topicData.forEach { topic => + topic.partitionData.forEach { partition => + val (topicName, topicId) = if (produceRequest.version() >= 12) { + (metadataCache.getTopicName(topic.topicId).getOrElse(topic.name), topic.topicId()) + } else { + (topic.name(), metadataCache.getTopicId(topic.name())) + } + + val topicPartition = new TopicPartition(topicName, partition.index()) + if (topicName == null || topicName.isEmpty) Review Comment: You right we don't need null as I use `metadataCache.getTopicName(topic.topicId).getOrElse(topic.name)` which if `metadataCache` doesn't continue topic name the default will be empty string which is the value of `topic.name` -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org