showuon commented on code in PR #12748:
URL: https://github.com/apache/kafka/pull/12748#discussion_r1017442642


##########
clients/src/test/java/org/apache/kafka/clients/consumer/CooperativeStickyAssignorTest.java:
##########
@@ -78,6 +80,26 @@ public void testDecodeGeneration() {
         assertFalse(((CooperativeStickyAssignor) 
assignor).memberData(subscription).generation.isPresent());
     }
 
+    @Test
+    public void 
testCooperativeStickyAssignorHonorSubscriptionUserdataIfNoGenerationIdInField() 
{
+        Map<String, Integer> partitionsPerTopic = new HashMap<>();
+        partitionsPerTopic.put(topic, 2);
+        int higherGenerationId = 2;
+        int lowerGenerationId = 1;
+
+        assignor.onAssignment(new 
ConsumerPartitionAssignor.Assignment(partitions(tp1)), new 
ConsumerGroupMetadata(groupId, higherGenerationId, consumer1, 
Optional.empty()));
+        ByteBuffer userDataWithHigherGenerationId = 
assignor.subscriptionUserData(new HashSet<>(topics(topic)));

Review Comment:
   We can use `buildSubscriptionWithGeneration` for consumer2 here, but not for 
consumer1. Please note, the consumer1 provides different owned partitions and 
generation id as the one provided in subscription. I'm trying to test which 
data we should honor in different cases. I've updated the comment to make it 
clear.



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