RongtongJin commented on code in PR #10448:
URL: https://github.com/apache/rocketmq/pull/10448#discussion_r3471629163


##########
broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:
##########
@@ -1714,6 +1791,58 @@ private RemotingCommand 
deleteSubscriptionGroup(ChannelHandlerContext ctx,
         return response;
     }
 
+    private RemotingCommand deleteSubscriptionGroupList(ChannelHandlerContext 
ctx,
+        RemotingCommand request) {
+        final RemotingCommand response = 
RemotingCommand.createResponseCommand(null);
+
+        DeleteSubscriptionGroupListRequestBody requestBody = 
DeleteSubscriptionGroupListRequestBody.decode(
+            request.getBody(), DeleteSubscriptionGroupListRequestBody.class);
+        List<String> groupNameList = requestBody == null ? null : 
requestBody.getGroupNameList();
+
+        if (CollectionUtils.isEmpty(groupNameList)) {
+            response.setCode(ResponseCode.INVALID_PARAMETER);
+            response.setRemark("The specified group name list is blank.");
+            return response;
+        }
+
+        // dedup while preserving the input order
+        Set<String> groupNames = new LinkedHashSet<>();
+        for (String groupName : groupNameList) {
+            if (UtilAll.isBlank(groupName)) {
+                response.setCode(ResponseCode.INVALID_PARAMETER);
+                response.setRemark("The specified group name is blank.");
+                return response;
+            }
+            groupNames.add(groupName);
+        }
+
+        LOGGER.info("AdminBrokerProcessor#deleteSubscriptionGroupList: 
groupNames={}, caller={}",
+            groupNames, RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
+
+        try {
+            // batch delete subscription group config in one persist
+            this.brokerController.getSubscriptionGroupManager()
+                .deleteSubscriptionGroupConfigList(new 
ArrayList<>(groupNames));
+
+            boolean cleanOffset = requestBody.isCleanOffset();
+            boolean autoDeleteUnusedStats = 
this.brokerController.getBrokerConfig().isAutoDeleteUnusedStats();
+            for (String groupName : groupNames) {
+                if (cleanOffset || LiteMetadataUtil.isLiteGroupType(groupName, 
this.brokerController)) {

Review Comment:
   Please snapshot this lite-group state before calling 
`deleteSubscriptionGroupConfigList(...)`. At this point the group config has 
already been removed, and `LiteMetadataUtil.isLiteGroupType(...)` calls 
`findSubscriptionGroupConfig(...)`. With the default 
`autoCreateSubscriptionGroup=true`, a missing group can be auto-created again 
when `cleanOffset` is false, so the batch delete can return success while the 
group config is recreated. A regression test for the `cleanOffset=false` path 
would catch this.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to