chia7712 commented on code in PR #19508: URL: https://github.com/apache/kafka/pull/19508#discussion_r2051739551
########## clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java: ########## @@ -3524,44 +3524,62 @@ void handleResponse(AbstractResponse abstractResponse) { for (final Node node : allNodes) { final long nowList = time.milliseconds(); runnable.call(new Call("listGroups", deadline, new ConstantNodeIdProvider(node.id())) { + + // If only regular consumer group types are required, we can try an earlier request version if + // UnsupportedVersionException is thrown + final boolean canTryEarlierRequestVersion = options.regularConsumerGroupTypes(); Review Comment: Instead of re-sending the request, maybe we can modify the request (ListGroupsRequest.Builder#build) when the version is small than v5? ```java if (!data.typesFilter().isEmpty() && version < 5) { var copy = new HashSet<>(data.typesFilter()); copy.remove(GroupType.CLASSIC.toString()); copy.remove(GroupType.CONSUMER.toString()); if (!copy.isEmpty()) throw new UnsupportedVersionException("The broker only supports ListGroups v" + version + ", but we need v5 or newer to request groups by type."); return new ListGroupsRequest(data.duplicate().setTypesFilter(List.of()), version); } ``` -- 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