FrankYang0529 commented on code in PR #19523: URL: https://github.com/apache/kafka/pull/19523#discussion_r2063438718
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Group.java: ########## @@ -209,4 +219,50 @@ void validateOffsetFetch( default boolean shouldExpire() { return true; } + + /** + * Computes the hash of the topics in a group. + * + * @param topicHashes The map of topic hashes. Key is topic name and value is the topic hash. + * @return The hash of the group. + */ + static long computeGroupHash(Map<String, Long> topicHashes) { Review Comment: > I wonder whether it is worth inlining the implementation from Guava or something similar to combine the hashes. It would avoid the extra collections. Yes, I copy some implementation to this function. > In the KIP, you also mentioned combining the index with the hash. Is this something done within `combineOrdered`? No, the `computeGroupHash` sorts topics by name and use this order to merge hashes. I also add test case `testComputeGroupHashWithDifferentOrder` and `testComputeGroupHashWithSameKeyButDifferentValue` to verify it. -- 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