dongnuo123 commented on code in PR #15442: URL: https://github.com/apache/kafka/pull/15442#discussion_r1507826893
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -3500,6 +3503,59 @@ public void maybeDeleteGroup(String groupId, List<Record> records) { } } + /** + * A group can be upgraded offline if it's a classic group and empty. + * + * @param groupId The group to be validated. + * @return true if the offline upgrade is valid. + */ + private boolean validateOfflineUpgrade(String groupId) { + Group group = groups.get(groupId); + + if (group == null || group.type() == CONSUMER) { + return false; + } + + ClassicGroup classicGroup = (ClassicGroup) group; + if (!classicGroup.isEmpty()) { + return false; + } else { + return true; + } + } + + /** + * Upgrade the empty classic group to a consumer group if it's valid. + * + * @param groupId The group id to be updated. + * @param records The list of records to delete the classic group and create the consumer group. + * @param isSimpleGroup The boolean indicating whether the group to be updated is a simple group. + */ + public void maybeUpgradeEmptyGroup(String groupId, List<Record> records, boolean isSimpleGroup) { Review Comment: I agree with it in the case of upgrading if a new member joining the empty group, but for the simple group we still need to create the new group. Is that correct? -- 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