Shekharrajak commented on code in PR #22357:
URL: https://github.com/apache/kafka/pull/22357#discussion_r3438398661


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTransactionTest.java:
##########
@@ -614,6 +698,45 @@ private ProducerRecord<byte[], byte[]> 
record(TopicPartition topicPartition, Str
         return new ProducerRecord<>(topicPartition.topic(), 
topicPartition.partition(), null, bytes, bytes);
     }
 
+    private List<TopicIdPartition> 
createTopicIdPartitionsMappedToAllShareStatePartitions(
+        String groupId,
+        String topicPrefix,
+        int partitionCount,
+        int replicationFactor
+    ) {
+        for (int attempt = 0; attempt < 24; attempt++) {
+            String topicName = topicPrefix + "-" + attempt;
+            Uuid topicId = createTopic(topicName, partitionCount, 
replicationFactor);
+            List<TopicIdPartition> topicIdPartitions = 
java.util.stream.IntStream.range(0, partitionCount)
+                .mapToObj(partition -> new TopicIdPartition(topicId, new 
TopicPartition(topicName, partition)))
+                .toList();
+            Map<Integer, TopicIdPartition> 
topicIdPartitionByShareStatePartition = new HashMap<>();
+            for (TopicIdPartition topicIdPartition : topicIdPartitions) {
+                topicIdPartitionByShareStatePartition.putIfAbsent(
+                    shareStatePartition(groupId, topicIdPartition.topicId(), 
topicIdPartition.partition()),
+                    topicIdPartition
+                );
+            }
+            if (topicIdPartitionByShareStatePartition.size() == 
sgsTopicPartitions.size()) {

Review Comment:
    one producer transaction can include share acks whose source partitions map 
to multiple __share_group_state partitions. So this helper method will help in 
IT 
   
   We must try out some better way of doing it. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to