FrankYang0529 commented on code in PR #17444:
URL: https://github.com/apache/kafka/pull/17444#discussion_r1821004115


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Utils.java:
##########
@@ -235,4 +238,20 @@ public static ApiMessage 
messageOrNull(ApiMessageAndVersion apiMessageAndVersion
             return apiMessageAndVersion.message();
         }
     }
+
+    public static long hashSubscriptionMetadata(Map<String, TopicMetadata> 
subscriptionMetadata) {

Review Comment:
   > When we replay records, we should only replay the persisted state. We 
should not compute hashes there based on the metadata image there.
   
   There are two parts of topic hash map. One is in coordinator 
(GroupMetadataManager), and another is in group (ModernGroup).
   
   For the coordinator, it's in memory cache. When a coordinator starts, we 
will recalculate it from metadata image in 
`GroupMetadataManager#subscribeGroupToTopic`. When there is a new metadata 
image, we recalculate changed topic hash.
   
   For the group, the hash map is updated when we replay 
`ConsumerGroupPartitionMetadataValue`. We will add a new field `hash` to 
`TopicMetadata`. Although it still calls `TopicMetadata`, we only cares hash 
value, so in the code, we only need to maintain `Map<String, Long> 
subscribedTopicHash`.



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