bbejeck commented on code in PR #18809: URL: https://github.com/apache/kafka/pull/18809#discussion_r1953412766
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -3405,6 +3616,49 @@ private void scheduleConsumerGroupRebalanceTimeout( }); } + /** + * Schedules a rebalance timeout for the member. + * + * @param groupId The group id. + * @param memberId The member id. + * @param memberEpoch The member epoch. + * @param rebalanceTimeoutMs The rebalance timeout. + */ + private void scheduleStreamsGroupRebalanceTimeout( + String groupId, + String memberId, + int memberEpoch, + int rebalanceTimeoutMs + ) { + String key = streamsGroupRebalanceTimeoutKey(groupId, memberId); + timer.schedule(key, rebalanceTimeoutMs, TimeUnit.MILLISECONDS, true, () -> { + try { + StreamsGroup group = streamsGroup(groupId); + StreamsGroupMember member = group.getOrMaybeCreateMember(memberId, false); + + if (member.memberEpoch() == memberEpoch) { + log.info("[GroupId {}] Member {} fenced from the group because " + + "it failed to transition from epoch {} within {}ms.", + groupId, memberId, memberEpoch, rebalanceTimeoutMs); + + return streamsGroupFenceMember(group, member, null); + } else { + log.debug("[GroupId {}] Ignoring rebalance timeout for {} because the member " + + "left the epoch {}.", groupId, memberId, memberEpoch); + return new CoordinatorResult<>(Collections.emptyList()); + } + } catch (GroupIdNotFoundException ex) { + log.debug("[GroupId {}] Could not fence {}} because the group does not exist.", Review Comment: SGTM -- 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