RivenSun2 commented on a change in pull request #11340: URL: https://github.com/apache/kafka/pull/11340#discussion_r716173366
########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java ########## @@ -1069,6 +1074,37 @@ private void maybeAutoCommitOffsetsSync(Timer timer) { } } + private void cleanUpConsumedOffsets(Map<TopicPartition, OffsetAndMetadata> willCommitOffsets) { Review comment: change codes already commit ########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java ########## @@ -1069,6 +1074,37 @@ private void maybeAutoCommitOffsetsSync(Timer timer) { } } + private void cleanUpConsumedOffsets(Map<TopicPartition, OffsetAndMetadata> willCommitOffsets) { + + if (willCommitOffsets.isEmpty()) + return; + + Set<String> validTopics = metadata.fetch().topics(); + Set<TopicPartition> toGiveUpTopicPartitions = new HashSet<>(); + + Iterator<Map.Entry<TopicPartition, OffsetAndMetadata>> iterator = willCommitOffsets.entrySet().iterator(); Review comment: change codes already commit ########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java ########## @@ -1054,6 +1056,9 @@ private void doAutoCommitOffsetsAsync() { private void maybeAutoCommitOffsetsSync(Timer timer) { if (autoCommitEnabled) { Map<TopicPartition, OffsetAndMetadata> allConsumedOffsets = subscriptions.allConsumed(); + + cleanUpConsumedOffsets(allConsumedOffsets); Review comment: change codes already commit ########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java ########## @@ -343,7 +344,7 @@ protected synchronized long timeToNextHeartbeat(long now) { * Ensure that the group is active (i.e. joined and synced) */ public void ensureActiveGroup() { - while (!ensureActiveGroup(time.timer(Long.MAX_VALUE))) { + while (!ensureActiveGroup(time.timer(Long.MAX_VALUE), null)) { Review comment: change codes already commit ########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java ########## @@ -420,7 +423,7 @@ boolean joinGroupIfNeeded(final Timer timer) { // need to set the flag before calling onJoinPrepare since the user callback may throw // exception, in which case upon retry we should not retry onJoinPrepare either. needsJoinPrepare = false; - onJoinPrepare(generation.generationId, generation.memberId); + onJoinPrepare(generation.generationId, generation.memberId, pollTimer == null ? time.timer(0L) : pollTimer); Review comment: change codes already commit ########## File path: clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinatorTest.java ########## @@ -1121,7 +1121,7 @@ public void testNormalJoinGroupFollower() { sync.groupAssignments().isEmpty(); }, syncGroupResponse(assigned, Errors.NONE)); - coordinator.joinGroupIfNeeded(time.timer(Long.MAX_VALUE)); + coordinator.joinGroupIfNeeded(time.timer(Long.MAX_VALUE),null); Review comment: change codes already commit -- 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