ltamber commented on code in PR #8969:
URL: https://github.com/apache/rocketmq/pull/8969#discussion_r1856246810


##########
broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:
##########
@@ -725,21 +724,28 @@ private synchronized RemotingCommand 
deleteTopic(ChannelHandlerContext ctx,
             }
         }
 
-        final Set<String> groups = 
this.brokerController.getConsumerOffsetManager().whichGroupByTopic(topic);
-        // delete pop retry topics first
-        try {
+        List<String> topicsToClean = new ArrayList<>();
+        topicsToClean.add(topic);
+
+        if 
(brokerController.getBrokerConfig().isClearRetryTopicWhenDeleteTopic()) {
+            final Set<String> groups = 
this.brokerController.getConsumerOffsetManager().whichGroupByTopic(topic);
             for (String group : groups) {
                 final String popRetryTopicV2 = 
KeyBuilder.buildPopRetryTopic(topic, group, true);
                 if 
(brokerController.getTopicConfigManager().selectTopicConfig(popRetryTopicV2) != 
null) {
-                    deleteTopicInBroker(popRetryTopicV2);
+                    topicsToClean.add(popRetryTopicV2);
                 }
                 final String popRetryTopicV1 = 
KeyBuilder.buildPopRetryTopicV1(topic, group);
                 if 
(brokerController.getTopicConfigManager().selectTopicConfig(popRetryTopicV1) != 
null) {
-                    deleteTopicInBroker(popRetryTopicV1);
+                    topicsToClean.add(popRetryTopicV1);
                 }
             }
-            // delete topic
-            deleteTopicInBroker(topic);
+        }
+
+        try {
+            for (String topicToClean : topicsToClean) {
+                // delete topic
+                deleteTopicInBroker(topicToClean);
+            }
         } catch (Throwable t) {
             return buildErrorResponse(ResponseCode.SYSTEM_ERROR, 
t.getMessage());

Review Comment:
   Can we logs specific error here? Also, for different errors, can we return 
with different error codes instead of returning all of them uniformly as 
SYSTEM_ERROR?



-- 
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: commits-unsubscr...@rocketmq.apache.org

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

Reply via email to