dajac commented on code in PR #10964: URL: https://github.com/apache/kafka/pull/10964#discussion_r920841796
########## clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java: ########## @@ -3263,6 +3282,95 @@ public void testListConsumerGroupOffsets() throws Exception { } } + @Test + public void testBatchedListConsumerGroupOffsets() throws Exception { + Cluster cluster = mockCluster(1, 0); + Time time = new MockTime(); + Map<String, ListConsumerGroupOffsetsSpec> groupSpecs = batchedListConsumerGroupOffsetsSpec(); + + try (AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(time, cluster, AdminClientConfig.RETRIES_CONFIG, "0")) { + env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); + env.kafkaClient().prepareResponse(prepareBatchedFindCoordinatorResponse(Errors.NONE, env.cluster().controller(), groupSpecs.keySet())); + + ListConsumerGroupOffsetsResult result = env.adminClient().listConsumerGroupOffsets(groupSpecs, new ListConsumerGroupOffsetsOptions()); + sendOffsetFetchResponse(env.kafkaClient(), groupSpecs, true); + + verifyListOffsetsForMultipleGroups(groupSpecs, result); + } + } + + @Test + public void testBatchedListConsumerGroupOffsetsWithNoBatchingSupport() throws Exception { Review Comment: @rajinisivaram I was a bit puzzled by this downgrade logic so I spent a bit more time to understand it. In short, it seems that the current implementation does not work. You can make it fail by failing the first offset fetch response with COORDINATOR_LOAD_IN_PROGRESS for instance. When the api driver retries, it groups together all the groups targeting the same coordinator. The current test seems to work because the driver execute steps sequentially. The right approach to implement is likely to make `ListConsumerGroupOffsetsHandler` implements `AdminApiHandler` instead of `Batched`. Then in `buildRequest`, we can look at the `batch` flag in the `lookupStrategy`. Ideally, this should be decoupled from the `lookupStrategy` but that might be enough in our case. Otherwise, we need to add another flag in the `ListConsumerGroupOffsetsHandler`. -- 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