hachikuji commented on a change in pull request #10252:
URL: https://github.com/apache/kafka/pull/10252#discussion_r586728427



##########
File path: 
core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala
##########
@@ -222,9 +216,16 @@ class BrokerMetadataListener(brokerId: Int,
 
   def handleRemoveTopicRecord(imageBuilder: MetadataImageBuilder,
                               record: RemoveTopicRecord): Unit = {
-    val removedPartitions = imageBuilder.partitionsBuilder().
-      removeTopicById(record.topicId())
-    
groupCoordinator.handleDeletedPartitions(removedPartitions.map(_.toTopicPartition).toSeq)
+    imageBuilder.topicIdToName(record.topicId()) match {
+      case None =>
+        throw new RuntimeException(s"Unable to locate topic with ID 
${record.topicId}")
+
+      case Some(topicName) =>
+        info(s"Processing deletion of topic $topicName with id 
${record.topicId}")
+        val removedPartitions = 
imageBuilder.partitionsBuilder().removeTopicById(record.topicId())
+        
groupCoordinator.handleDeletedPartitions(removedPartitions.map(_.toTopicPartition).toSeq)
+        configRepository.remove(new ConfigResource(ConfigResource.Type.TOPIC, 
topicName))

Review comment:
       I see what you mean. The `RemoveTopic` schema does not include the topic 
name, so our hands are tied here at the moment. The `Config` schema, on the 
other hand, uses topic name, which is a consequence of the way that we treat 
configs. Probably `RemoveTopic` should also indicate the topic name. I will 
file a separate JIRA to think about 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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to