You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/17 04:55:00 UTC

[GitHub] [kafka] dengziming commented on a change in pull request #9754: KAFKA-10856: Convert sticky assignor userData schemas to use generated protocol

dengziming commented on a change in pull request #9754:
URL: https://github.com/apache/kafka/pull/9754#discussion_r544811722



##########
File path: clients/src/main/java/org/apache/kafka/clients/consumer/StickyAssignor.java
##########
@@ -222,51 +204,50 @@ protected MemberData memberData(Subscription subscription) {
         return deserializeTopicPartitionAssignment(userData);
     }
 
-    // visible for testing
     static ByteBuffer serializeTopicPartitionAssignment(MemberData memberData) {
-        Struct struct = new Struct(STICKY_ASSIGNOR_USER_DATA_V1);
-        List<Struct> topicAssignments = new ArrayList<>();
+        return serializeTopicPartitionAssignment(memberData, StickyAssignorUserData.HIGHEST_SUPPORTED_VERSION);
+    }
+
+    // visible for testing
+    static ByteBuffer serializeTopicPartitionAssignment(MemberData memberData, short version) {
+
+        List<StickyAssignorUserData.TopicPartition> topicAssignments = new ArrayList<>();
         for (Map.Entry<String, List<Integer>> topicEntry : CollectionUtils.groupPartitionsByTopic(memberData.partitions).entrySet()) {

Review comment:
       Because topicAssignments put all partitions of a topic in a field. I think the name `TopicPartition` is misleading and I changed it to `TopicPartitions`, and also the `TopicPartition` in ConsumerProtocolAssignment.json and ConsumerProtocolSubscription.json is also misleading, we could also create a new pr the alter them.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org