dajac commented on code in PR #12181:
URL: https://github.com/apache/kafka/pull/12181#discussion_r892276337


##########
core/src/main/scala/kafka/server/AlterPartitionManager.scala:
##########
@@ -263,7 +286,11 @@ class DefaultAlterPartitionManager(
         val partitionResponses = new mutable.HashMap[TopicPartition, 
Either[Errors, LeaderAndIsr]]()
         data.topics.forEach { topic =>
           topic.partitions.forEach { partition =>
-            val tp = new TopicPartition(topic.name, partition.partitionIndex)
+            val tp = new TopicPartition(
+              topicNamesByIds.getOrElse(topic.topicId, topic.topicName),

Review Comment:
   Using the MetadataCache is not ideal here in the ZK mode. The issue is that 
the MetadataCache is populated by the UpdateMetadata request which is sent 
after the LeaderAndIsr request so we can end up in a situation where we would 
send an AlterPartition request with a topic id which is not in the 
MetadataCache yet. This is why I prefer to rely on the information used to send 
the request here. (We had similar issues on the fetch/fetcher path.)
   
   I do agree with the stronger validation of `topicName`. Let me address this.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to