Repository: kafka
Updated Branches:
  refs/heads/trunk 15cba9f00 -> a5b11886d


KAFKA-2345;  Attempt to delete a topic already marked for deletion throws 
ZkNodeExistsException; patched by Ashish Singh; reviewed by Sriharsha 
Chintalapani and Ismael Juma


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/a5b11886
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/a5b11886
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/a5b11886

Branch: refs/heads/trunk
Commit: a5b11886df8c7aad0548efd2c7c3dbc579232f03
Parents: 15cba9f
Author: Ashish Singh <asi...@cloudera.com>
Authored: Fri Jul 17 10:32:43 2015 -0700
Committer: Gwen Shapira <csh...@gmail.com>
Committed: Fri Jul 17 10:32:43 2015 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/admin/AdminUtils.scala | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/a5b11886/core/src/main/scala/kafka/admin/AdminUtils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/admin/AdminUtils.scala 
b/core/src/main/scala/kafka/admin/AdminUtils.scala
index f06edf4..2b4e028 100644
--- a/core/src/main/scala/kafka/admin/AdminUtils.scala
+++ b/core/src/main/scala/kafka/admin/AdminUtils.scala
@@ -163,7 +163,13 @@ object AdminUtils extends Logging {
   }
   
   def deleteTopic(zkClient: ZkClient, topic: String) {
-    ZkUtils.createPersistentPath(zkClient, ZkUtils.getDeleteTopicPath(topic))
+    try {
+      ZkUtils.createPersistentPath(zkClient, ZkUtils.getDeleteTopicPath(topic))
+    } catch {
+      case e1: ZkNodeExistsException => throw new 
TopicAlreadyMarkedForDeletionException(
+        "topic %s is already marked for deletion".format(topic))
+      case e2: Throwable => throw new AdminOperationException(e2.toString)
+    }
   }
   
   def isConsumerGroupActive(zkClient: ZkClient, group: String) = {

Reply via email to