FrankYang0529 commented on code in PR #17444:
URL: https://github.com/apache/kafka/pull/17444#discussion_r1820813089
##########
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:
> Why not using a single hash?
If just using a single hash for subscribed topics in a group, that means
each group needs to recalculate the hash value. If using a hash for a topic,
the coordinator can calculate a new hash when there is topic update. each group
can get the latest hash and compare with current hash to know whether there is
any update.

> The cache will be updated whenever a group needs to calculate the hash for
an uncached topic or when new metadata brings a topic change.
Like I mentioned in previous comment
(https://github.com/apache/kafka/pull/17444#discussion_r1820720961). When a
coordinator starts, it replays all records. At that time, the coordinator
calculate initial hash in `GroupMetadataManager#subscribeGroupToTopic`. When
there is new metadata image, we calculate a new hash for each changed topic and
request metadata refresh for related groups. In next group heartbeat, the
coordinator constructs a new hash map from the cache and compares with current
hash map in the group.
--
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]