This is an automated email from the ASF dual-hosted git repository. guozhang pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push: new 1a33b65 KAFKA-13175; Optimization TopicExistsException,When a topic is marked for deletion. (#11226) 1a33b65 is described below commit 1a33b65e0f91cb19c6cd24ccf7c67e3ed09ce72e Author: Weisheng Yang <46277267+yangdai...@users.noreply.github.com> AuthorDate: Thu Sep 2 01:16:41 2021 +0800 KAFKA-13175; Optimization TopicExistsException,When a topic is marked for deletion. (#11226) After a topic is deleted, the topic is marked for deletion, create topic with the same name throw exception topic already exists. It should indicate the topic is marked for deletion. Reviewers: Guozhang Wang <wangg...@gmail.com> --- core/src/main/scala/kafka/zk/AdminZkClient.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/kafka/zk/AdminZkClient.scala b/core/src/main/scala/kafka/zk/AdminZkClient.scala index 31c38bd..0c4e3b5 100644 --- a/core/src/main/scala/kafka/zk/AdminZkClient.scala +++ b/core/src/main/scala/kafka/zk/AdminZkClient.scala @@ -126,7 +126,9 @@ class AdminZkClient(zkClient: KafkaZkClient) extends Logging { partitionReplicaAssignment: Map[Int, Seq[Int]], config: Properties): Unit = { Topic.validate(topic) - + if (zkClient.isTopicMarkedForDeletion(topic)) { + throw new TopicExistsException(s"Topic '$topic' is marked for deletion.") + } if (zkClient.topicExists(topic)) throw new TopicExistsException(s"Topic '$topic' already exists.") else if (Topic.hasCollisionChars(topic)) {