kirktrue commented on code in PR #17700: URL: https://github.com/apache/kafka/pull/17700#discussion_r1912345812
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetchRequestManagerTest.java: ########## @@ -3437,6 +3441,72 @@ public void testPollWithRedundantCreateFetchRequests() { } + @Test + public void testFetchSessionTestEviction() { + buildFetcher(); + + Set<TopicPartition> partitions = Set.of(tp0, tp1, tp2, tp3); + assignFromUser(partitions); + client.updateMetadata( + RequestTestUtils.metadataUpdateWithIds( + 2, + singletonMap(topicName, 4), + tp -> validLeaderEpoch, + topicIds, + false + ) + ); + + Map<Node, Set<TopicPartition>> nodeToPartitionMap = new HashMap<>(); + + partitions.forEach(tp -> { + subscriptions.seek(tp, 1); + Node node = metadata.fetch().leaderFor(tp); + nodeToPartitionMap.computeIfAbsent(node, k -> new HashSet<>()).add(tp); + }); + + assertEquals(nodeToPartitionMap.size(), sendFetches()); + assertFalse(fetcher.hasCompletedFetches()); + + nodeToPartitionMap.keySet().forEach(node -> { + Set<TopicPartition> nodePartitions = nodeToPartitionMap.get(node); + assertNotNull(nodePartitions); + LinkedHashMap<TopicIdPartition, FetchResponseData.PartitionData> partitionDataMap = new LinkedHashMap<>(); + + nodePartitions.forEach(tp -> { + TopicIdPartition tidp = new TopicIdPartition(topicId, tp); + FetchResponseData.PartitionData partitionData = new FetchResponseData.PartitionData() + .setPartitionIndex(tp1.partition()) Review Comment: Yes. Thanks for catching. -- 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