smjn commented on code in PR #18848:
URL: https://github.com/apache/kafka/pull/18848#discussion_r1954242074


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -822,21 +834,60 @@ public 
CompletableFuture<DeleteGroupsResponseData.DeletableGroupResultCollection
         });
 
         groupsByTopicPartition.forEach((topicPartition, groupList) -> {
-            
CompletableFuture<DeleteGroupsResponseData.DeletableGroupResultCollection> 
future =
-                runtime.scheduleWriteOperation(
-                    "delete-groups",
-                    topicPartition,
-                    Duration.ofMillis(config.offsetCommitTimeoutMs()),
-                    coordinator -> coordinator.deleteGroups(context, groupList)
-                ).exceptionally(exception -> handleOperationException(
-                    "delete-groups",
-                    groupList,
-                    exception,
-                    (error, __) -> 
DeleteGroupsRequest.getErrorResultCollection(groupList, error),
-                    log
-                ));
-
-            futures.add(future);
+            
CompletableFuture<DeleteGroupsResponseData.DeletableGroupResultCollection> 
shareFuture = deleteShareGroups(topicPartition, groupList)
+                .thenCompose(groupErrMap -> {
+                    DeleteGroupsResponseData.DeletableGroupResultCollection 
collection = new DeleteGroupsResponseData.DeletableGroupResultCollection();
+                    List<String> errGroupIds = new ArrayList<>();
+                    groupErrMap.forEach((groupId, error) -> {
+                        if (error.code() != Errors.NONE.code()) {
+                            log.error("Error deleting share group {} due to 
error {}", groupId, error);
+                            errGroupIds.add(groupId);
+                            collection.add(
+                                new 
DeleteGroupsResponseData.DeletableGroupResult()
+                                    .setGroupId(groupId)
+                                    .setErrorCode(error.code())
+                            );
+                        }
+                    });
+
+                    Set<String> groupSet = new HashSet<>(groupList);
+                    // Remove all share group ids which have errored out
+                    // when deleting with persister.
+                    errGroupIds.forEach(groupSet::remove);

Review Comment:
   changed per IDE suggestion
   ```
   Call to 'set.removeAll(list)' may work slowly 
   ```



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to