Sandeep Nemuri created KAFKA-7037: ------------------------------------- Summary: Kafka doesn't allow to delete topic with '+' in the name Key: KAFKA-7037 URL: https://issues.apache.org/jira/browse/KAFKA-7037 Project: Kafka Issue Type: Bug Affects Versions: 0.10.1.0 Reporter: Sandeep Nemuri
{code:java} [kafka@localhost ~]$ /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --create --zookeeper `hostname`:2181 --replication-factor 1 --partitions 1 --topic test+topic Created topic "test+topic". [kafka@localhost ~]$ /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper `hostname`:2181 --list __consumer_offsets test+topic [kafka@localhost~]$ /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper `hostname`:2181 --delete --topic test+topic Error while executing topic command : Topic test+topic does not exist on ZK path ssltester-3.openstacklocal:2181 [2018-06-11 09:36:32,989] ERROR java.lang.IllegalArgumentException: Topic test+topic does not exist on ZK path ssltester-3.openstacklocal:2181 at kafka.admin.TopicCommand$.deleteTopic(TopicCommand.scala:166) at kafka.admin.TopicCommand$.main(TopicCommand.scala:68) at kafka.admin.TopicCommand.main(TopicCommand.scala) (kafka.admin.TopicCommand$) {code} The major issue is that while executing a delete command kafka cli tool is removing the "+" symbol and deleting the incorrect topic. In below case if _"*test+topic"*_ is deleted kafka deletes _*testtopic.*_ {code:java} [kafka@localhost~]$ /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --create --zookeeper `hostname`:2181 --replication-factor 1 --partitions 1 --topic testtopic Created topic "testtopic". [kafka@localhost~]$ /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper `hostname`:2181 --topic test+topic --delete Topic testtopic is marked for deletion.{code} It seems create topic doesn't check for '+' and delete topic replaces '+' from the topic name. Create Topic: [https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/internals/Topic.java#L77-L85] Delete Topic : [https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/consumer/TopicFilter.scala#L28-L33] -- This message was sent by Atlassian JIRA (v7.6.3#76005)