You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/07/20 14:44:01 UTC

[GitHub] [rocketmq] JanWarlen commented on issue #4644: ./mqadmin deleteTopic has an error

JanWarlen commented on issue #4644:
URL: https://github.com/apache/rocketmq/issues/4644#issuecomment-1190377624

   sorry about lost the broker exec code:
   ```java
   org.apache.rocketmq.broker.processor.AdminBrokerProcessor#deleteTopic
   private synchronized RemotingCommand deleteTopic(ChannelHandlerContext ctx,
           RemotingCommand request) throws RemotingCommandException {
           final RemotingCommand response = RemotingCommand.createResponseCommand(null);
           if (validateSlave(response)) {
               // TODO 有个bug,mqadmin deleteTopic 命令执行时始终失败,异常信息是这里返回的response
               //  但是使用arthas监听broker方法的返回值,response 的code是0-SUCCESS
               //  通过dashhboard 界面删除是正常的
   // here is the problem
               return response;
           }
           DeleteTopicRequestHeader requestHeader =
               (DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);
   
           log.info("deleteTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
   
           String topic = requestHeader.getTopic();
           if (!TopicValidator.validateTopic(topic, response)) {
               return response;
           }
           if (TopicValidator.isSystemTopic(topic, response)) {
               return response;
           }
   
           if (MixAll.isLmq(topic)) {
               this.brokerController.getMessageStore().cleanUnusedLmqTopic(topic);
               response.setCode(ResponseCode.SUCCESS);
               response.setRemark(null);
               return response;
           }
   
           this.brokerController.getTopicConfigManager().deleteTopicConfig(topic);
           this.brokerController.getMessageStore()
               .cleanUnusedTopic(this.brokerController.getTopicConfigManager().getTopicConfigTable().keySet());
           if (this.brokerController.getBrokerConfig().isAutoDeleteUnusedStats()) {
               this.brokerController.getBrokerStatsManager().onTopicDeleted(requestHeader.getTopic());
           }
           response.setCode(ResponseCode.SUCCESS);
           response.setRemark(null);
           return response;
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org