dajac commented on code in PR #15721: URL: https://github.com/apache/kafka/pull/15721#discussion_r1576113492
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -1422,10 +1499,16 @@ private CoordinatorResult<ConsumerGroupHeartbeatResponseData, Record> consumerGr ) throws ApiException { ConsumerGroup group = consumerGroup(groupId); List<Record> records; + CompletableFuture<Void> appendFuture = null; if (instanceId == null) { ConsumerGroupMember member = group.getOrMaybeCreateMember(memberId, false); log.info("[GroupId {}] Member {} left the consumer group.", groupId, memberId); - records = consumerGroupFenceMember(group, member); + if (validateOnlineDowngrade(group, memberId)) { + records = new ArrayList<>(); + appendFuture = convertToClassicGroup(group, memberId, records); + } else { + records = consumerGroupFenceMember(group, member); + } Review Comment: Having this duplicated code in multiple places is a tad annoying, don't you think? I wonder if we could push it down into `consumerGroupFenceMember` as it seems that the downgrade must be checked whenever `consumerGroupFenceMember` is called. `consumerGroupFenceMember` could return a future or null and take the records as an argument. -- 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