You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/05/23 14:39:11 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #8717: KAFKA-10033: Throw UnknownTopicOrPartitionException when modifying a non-existent topic's config

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:
users@infra.apache.org