chia7712 commented on a change in pull request #8717:
URL: https://github.com/apache/kafka/pull/8717#discussion_r429551641



##########
File path: core/src/main/scala/kafka/server/AdminManager.scala
##########
@@ -454,6 +454,9 @@ class AdminManager(val config: KafkaConfig,
   private def alterTopicConfigs(resource: ConfigResource, validateOnly: 
Boolean,
                                 configProps: Properties, configEntriesMap: 
Map[String, String]): (ConfigResource, ApiError) = {
     val topic = resource.name
+    if (!metadataCache.contains(topic))
+      throw new UnknownTopicOrPartitionException(s"The topic '$topic' does not 
exist.")
+
     adminZkClient.validateTopicConfig(topic, configProps)

Review comment:
       It seems not all checks in ```validateTopicConfig``` are required. 
   
   1. ```Topic.validate(topic)``` -> the topic is validated already as the 
topic is created
   1. ```if (!zkClient.topicExists(topic))``` -> it is replaced by ```if 
(!metadataCache.contains(topic))```
   1. ```LogConfig.validate(configs)``` -> this should be reserved
   
   In short, should we remove ```adminZkClient.validateTopicConfig(topic, 
configProps)``` and then add ```LogConfig.validate(configs)```?




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