RivenSun2 commented on a change in pull request #11340:
URL: https://github.com/apache/kafka/pull/11340#discussion_r713805122



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -670,10 +662,11 @@ private void validateCooperativeAssignment(final 
Map<String, List<TopicPartition
     }
 
     @Override
-    protected void onJoinPrepare(int generation, String memberId) {
+    protected void onJoinPrepare(int generation, String memberId, final Timer 
pollTimer) {
         log.debug("Executing onJoinPrepare with generation {} and memberId 
{}", generation, memberId);
         // commit offsets prior to rebalance if auto-commit enabled
-        
maybeAutoCommitOffsetsSync(time.timer(rebalanceConfig.rebalanceTimeoutMs));
+        //The timer whose commitOffset timed out is no longer 
time.timer(rebalanceConfig.rebalanceTimeoutMs), and is changed to the timer 
passed by the customer
+        maybeAutoCommitOffsetsSync(pollTimer);

Review comment:
       Thank you for your reminder. I suggest that when pollTimer is null, it 
is safer to pass `time.timer(0L)` to `maybeAutoCommitOffsetsSync` instead of 
passing the old `time.timer(rebalanceConfig.rebalanceTimeoutMs)`
   
   `time.timer(0L)` indicates that if allConsumedOffsets is not empty, submit 
the offset synchronously at least once




-- 
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


Reply via email to