Optimization TopicExistsException,When a topic is marked for deletion.
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
@@ -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)) {
