A variation on the posted question - as a new thread so that not to high-jack 
the original one...
How long does it usually take to finally delete the topic? I tried to delete 
the topic via 
/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic mytopic
and saw that it was "marked for deletion". However,  about 30 hours later, the 
topic is still showing up in the list of topics:
=> bin/kafka-topics.sh --list --zookeeper localhost:2181
__consumer_offsets
mytopic

The topic did have about 150 million events as Log size, but none were 
unprocessed (Lag == 0).
As a test , I tried to create a new topic , and delete it right away with no 
events posted - and in that case it was deleted for good right away.
I'm using kafka 1.8.2.1
thanks!MArina

      From: Stevo Slavić <ssla...@gmail.com>
 To: users@kafka.apache.org 
 Sent: Thursday, July 16, 2015 6:56 PM
 Subject: Re: Delete topic using Admintools is not working
   
Hello Sivananda,

Calling AdminUtils.deleteTopic just requests topic to be deleted - it does
not actually delete topic immediately. Requests for topic deletion get
saved in ZooKeeper as a node (named by topic name), under
/admin/delete_topics node.

If brokers in the cluster are configured with topic deletion enabled, and
if they are running, they will notice requests to delete the topic, perform
actual deletion (all partitions on all brokers, lead and replicas, as well
as deletion of topic metadata in zookeeper), and also delete saved request
for topic deletion (that node under /admin/delete_topics). This broker side
part of topic deletion process is only working in Kafka 0.8.2.x.

>From your stack trace it seems you've requested topic deletion at least
twice, while topic has not been deleted yet, so zk client used by admin
utils, throws exception signalling that the node (request for topic
deletion) already exists.

If topic is not getting deleted even after a while I'd suggest that you
check version, configuration and running status of your Kafka cluster.

Kind regards,
Stevo Slavic.



On Fri, Jul 17, 2015 at 12:40 AM, Sivananda Reddy <sivananda2...@gmail.com>
wrote:

> Hi,
>
> As per the jira https://issues.apache.org/jira/browse/KAFKA-1737, I have
> set ZKStringSerializer, while creating the ZkClient and still the delete
> topic function call is not working:
>
> Version: kafka_2.11-0.8.2.1
>
> *My code looks like this*:
> ZkClient zkClient = new ZkClient("localhost:2181", 6000, 6000,
> ZKStringSerializer$.MODULE$);
> AdminUtils.deleteTopic(zkClient, "testTopic17");
>
> *I am getting the following exception's*:
> Exception in thread "main"
> org.I0Itec.zkclient.exception.ZkNodeExistsException:
> org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode =
> NodeExists for /admin/delete_topics/testTopic17
>    at
> org.I0Itec.zkclient.exception.ZkException.create(ZkException.java:55)
>    at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:685)
>    at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
>    at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:243)
>    at kafka.utils.ZkUtils$.createPersistentPath(ZkUtils.scala:306)
>    at kafka.admin.AdminUtils$.deleteTopic(AdminUtils.scala:159)
>    at kafka.admin.AdminUtils.deleteTopic(AdminUtils.scala)
>    at Test.deleteTopic(Test.java:98)
>    at Test.main(Test.java:76)
> Caused by: org.apache.zookeeper.KeeperException$NodeExistsException:
> KeeperErrorCode = NodeExists for /admin/delete_topics/testTopic17
>    at
> org.apache.zookeeper.KeeperException.create(KeeperException.java:119)
>    at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
>    at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
>    at org.I0Itec.zkclient.ZkConnection.create(ZkConnection.java:87)
>    at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:308)
>    at org.I0Itec.zkclient.ZkClient$1.call(ZkClient.java:304)
>    at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:675)
>    ... 7 more
>
> *The corresponding zookeeper logs*:
> [2015-07-16 15:31:14,383] INFO Accepted socket connection from /
> 127.0.0.1:23363 (org.apache.zookeeper.server.NIOServerCnxnFactory)
> [2015-07-16 15:31:14,385] INFO Client attempting to establish new session
> at /127.0.0.1:23363 (org.apache.zookeeper.server.ZooKeeperServer)
> [2015-07-16 15:31:14,391] INFO Established session 0x14e98d2ce98000c with
> negotiated timeout 6000 for client /127.0.0.1:23363
> (org.apache.zookeeper.server.ZooKeeperServer)
> [2015-07-16 15:31:14,510] INFO Got user-level KeeperException when
> processing sessionid:0x14e98d2ce98000c type:create cxid:0x1 zxid:0x963
> txntype:-1 reqpath:n/a Error Path:/admin/delete_topics/testTopic17
> Error:KeeperErrorCode = NodeExists for /admin/delete_topics/testTopic17
> (org.apache.zookeeper.server.PrepRequestProcessor)
> [2015-07-16 15:31:14,842] WARN caught end of stream exception
> (org.apache.zookeeper.server.NIOServerCnxn)
> EndOfStreamException: Unable to read additional data from client sessionid
> 0x14e98d2ce98000c, likely client has closed socket
>    at
> org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:228)
>    at
>
> org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:208)
>    at java.lang.Thread.run(Thread.java:744)
> [2015-07-16 15:31:14,843] INFO Closed socket connection for client /
> 127.0.0.1:23363 which had sessionid 0x14e98d2ce98000c
> (org.apache.zookeeper.server.NIOServerCnxn)
> [2015-07-16 15:31:21,000] INFO Expiring session 0x14e98d2ce98000c, timeout
> of 6000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
> [2015-07-16 15:31:21,001] INFO Processed session termination for sessionid:
> 0x14e98d2ce98000c (org.apache.zookeeper.server.PrepRequestProcessor)
>
> Could someone please let me know if I am missing anything?
>
> Thank you,
> Siva.
>


  

Reply via email to