5
votes

I am using kafka, zookeeper and kafka-manager for managing clusters.

I have 3 nodes cluster. In all the cluster I set since very beginning delete.topic.enable=true

Now when I want to delete a topic it is showing following error.

topicxyz - marked for deletion

but it is not deleted.

I tried to delete from kafka-manager also and it says

Yikes! KeeperErrorCode = NodeExists for /admin/delete_topics/topicxyz

Error logs:

kafka-manager:

[ESC[31merrorESC[0m] k.m.ApiError$ - error : KeeperErrorCode = NodeExists for /admin/delete_topics/topicxyz
org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists for /admin/delete_topics/topicxyz
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:119) ~[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
        at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783) ~[org.apache.zookeeper.zookeeper-3.4.6.jar:3.4.6-1569965]
        at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:721) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:704) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:108) ~[org.apache.curator.curator-client-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:701) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:477) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:467) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
        at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:447) ~[org.apache.curator.curator-framework-2.10.0.jar:na]
[ESC[37minfoESC[0m] k.m.a.KafkaManagerActor - Updating internal state...

kafka has no error log. zookeeper stdout errorlog says only warning and stderr log says Invalid config, exiting abnormally

kafka-version: kafka_2.12-0.10.2.0

Topic description:

 $ bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic topicxyz
Topic:topicxyz  PartitionCount:1    ReplicationFactor:1 Configs:
    Topic: topicxyz Partition: 0    Leader: -1  Replicas: 3 Isr: 

Please help.

2
The command only marks the topic as "to-be-deleted" state. Once it's done, controller should be informed and get started with the deletion. So you could wait a while to see if the topic is deleted completely. Besides, you could also run kafka-topics --describe to check the state of topic.amethystic
$ bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic topicxyz topic: topicxyz PartitionCount:1 ReplicationFactor:1 Configs: Topic: topicxyz Partition: 0 Leader: -1 Replicas: 2 Isr:Avinash
I have waited a lot but it seems this is not gonna work.Avinash
Are you sure that after topic is deleted it's not recreated straightaway by some application which writes to that topic?streetturtle
No, this is not the case. I fixed above problem by enabling active offset cache from kafka-manager. But Today again the same problem.Avinash

2 Answers

0
votes

I am not sure which kafka version are you using. But deleting a topic had a bug previously. Refer here & here.

0
votes

This is sometimes caused by a corrupt ZooKeeper node found within /admin/delete_topics. Log into the ZK client and delete the misbehaving /admin/delete_topics/your_topic_name entry. Depending on client version it will go something like this:

bin/zkCli.sh -server 127.0.0.1:2181 ls /admin/delete_topics ls /brokers/topics rmr /admin/delete_topics/your_topic_name

You should now be able to use Kafka Manager or Kafka-topics to delete your topics. You can also manually remove your topic by deleting the "/brokers/topics/your_topic_name" entry but I find that is unnecessary after removing the misbehaving "delete_topics" entry.