Closed 1782935682 closed 8 months ago
How do you create and delete topics? dashboard or mqadmin or sdk? I want to try to reproduce this issue
How do you create and delete topics? dashboard or mqadmin or sdk? I want to try to reproduce this issue
1.create with dashboard,create topic on cluster
2.use sdk , delete topic in one broker
org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl#deleteTopicInBroker;
DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(new AclClientRPCHook(new SessionCredentials("ak", "sk")), 20000);
String name = UUID.randomUUID().toString();
mqAdminExt.setInstanceName(name);
mqAdminExt.setNamesrvAddr(DEFAULT_NAMESRVADDR);
mqAdminExt.start();
System.out.println("delete before");
System.out.println("topicRouter" + ": " + JSON.toJSONString(mqAdminExt.examineTopicRouteInfo(TOPIC), true));
mqAdminExt.deleteTopicInBroker(Collections.singleton(broker01), TOPIC);
System.out.println("delete after");
System.out.println("topicRouter" + ": " + JSON.toJSONString(mqAdminExt.examineTopicRouteInfo(TOPIC), true));
i reproduce this issue, but i find when I restart my broker this topic has been deleted, i guess broker have some schedule to delete topic
yes rocketmq delete topic Only the topic data in memory will be deleted
protected TopicConfig removeTopicConfig(String topicName) {
return this.topicConfigTable.remove(topicName);
}
TopicQueueMappingDetail old = this.topicQueueMappingTable.remove(topic);
你需要继续调用 deleteTopicInNameServer
会删除topic全部路由,不能删除指定broker的路由
如果你只是要在一个broker删除,删除之后,等一会,broker会向ns注册,然后再查询。
你这个问题,还可以通过打开
在broker打开,enableSingleTopicRegister这个配置。 在ns 打开deleteTopicWithBrokerRegistration 这个配置来解决。可以看下这块代码。
Before Creating the Bug Report
[x] I found a bug, not just asking a question, which should be created in GitHub Discussions.
[X] I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
[X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
1
RocketMQ version
release-5.2.0
JDK Version
1.8
Describe the Bug
The topicRouter is not updated when I delete a topic in the broker
org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl#deleteTopicInBroker
Steps to Reproduce
What Did You Expect to See?
the topicRouter shoud be updated when delete topic in broker
What Did You See Instead?
1
Additional Context
No response