chia7712 commented on code in PR #17444:
URL: https://github.com/apache/kafka/pull/17444#discussion_r1820684694
##########
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:
hi @dajac
@FrankYang0529 and I discussed this offline, and we could tier the hash by
topic to address both reduced space usage and computation:
1. The coordinator will maintain an in-memory cache `Map<UUID, Integer>`
where the key is the topic UUID and the value is the hash based on 'name +
partitions + racks'.
2. `ModernGroup#subscribedTopicMetadata` will be changed from `<String,
TopicMetadata>` to `<String, Integer>`.
3. 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.
Advantages of this approach:
1. We can replace `TopicMetadata` with an `integer`, saving space.
2. We can reuse cached hashes, reducing computation."
--
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]