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


##########
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:
   I would like to add some implementation detail about the "cache" in 
GroupMetadataManager, so we don't waste resource to store unsubscribed topics 
or recalculate a topic hash with same value.
   
   1. Only compute topic hash which is subscribed by a group. That means we 
will compute topic hash in `GroupMetadataManager#subscribeGroupToTopic` when 
it's first time subscribed by one of groups. Also, the hash value will be 
removed in `GroupMetadataManager#unsubscribeGroupFromTopic` if there is no 
group subscribes it.
   2. In `GroupMetadataManager#onNewMetadataImage`, we only recalculate topic 
hash which is in `topicsDelta.changedTopics()`.



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