vinothchandar commented on a change in pull request #8737: URL: https://github.com/apache/kafka/pull/8737#discussion_r432594472
########## File path: core/src/main/scala/kafka/admin/TopicCommand.scala ########## @@ -259,7 +263,8 @@ object TopicCommand extends Logging { override def alterTopic(opts: TopicCommandOptions): Unit = { val topic = new CommandTopicPartition(opts) val topics = getTopics(opts.topic, opts.excludeInternalTopics) - ensureTopicExists(topics, opts.topic) + ensureTopicExists(topics, opts.topic, !opts.ifExists) Review comment: @cmccabe So this is a tad more complicated.. In general, we need to do `getTopics` to deal with wildcard/regex arguments (all of these commands support them, even `alter`). To fix this, we need to move the resolution of regex to actual topic names further into AdminClient/Server.. This does not seem trivial to me. Specifically for `alter` we need to pull down the existing partition metadata to add more partitions, so we have a bigger TOCTOU issue here anyway.. Again something that needs better admin client APIs That said, I do like having an eye towards making all these tools more scalable down the line. I can create a parent JIRA and keep filing these issues under there... (please let me know if a JIRA already exists like that).. ---------------------------------------------------------------- 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