dajac commented on code in PR #15462:
URL: https://github.com/apache/kafka/pull/15462#discussion_r1515976925


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -498,29 +497,17 @@ public CompletableFuture<ListGroupsResponseData> 
listGroups(
             );
         }
 
-        final Set<TopicPartition> existingPartitionSet = runtime.partitions();
-
-        if (existingPartitionSet.isEmpty()) {
-            return CompletableFuture.completedFuture(new 
ListGroupsResponseData());
-        }
-
-        final 
List<CompletableFuture<List<ListGroupsResponseData.ListedGroup>>> futures =
-            new ArrayList<>();
-
-        for (TopicPartition tp : existingPartitionSet) {
-            futures.add(runtime.scheduleReadOperation(
-                "list-groups",
-                tp,
-                (coordinator, lastCommittedOffset) -> 
coordinator.listGroups(request.statesFilter(), request.typesFilter(), 
lastCommittedOffset)
-            ).exceptionally(exception -> {
-                exception = Errors.maybeUnwrapException(exception);
-                if (exception instanceof NotCoordinatorException) {
-                    return Collections.emptyList();
-                } else {
-                    throw new CompletionException(exception);
-                }
-            }));
-        }
+        final 
List<CompletableFuture<List<ListGroupsResponseData.ListedGroup>>> futures = 
runtime.scheduleReadAllOperation(
+            "list-groups",
+            (coordinator, lastCommittedOffset) -> 
coordinator.listGroups(request.statesFilter(), request.typesFilter(), 
lastCommittedOffset)
+        ).stream().map(future -> future.exceptionally(exception -> {

Review Comment:
   I just pushed a commit with the `mapExceptionally` construct that I was 
thinking about. Please let me know what you think.



-- 
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