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



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
##########
@@ -420,9 +421,14 @@ 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);
+                if (!onJoinPrepare(generation.generationId, 
generation.memberId))

Review comment:
       You're right. How about this:
   ```java
   
   if (needsJoinPrepare) {
       try {
           if (onJoinPrepare(generation.generationId, generation.memberId))
               needsJoinPrepare = false;
           else
               return false;
       } catch (KafkaException e) {
               // if onJoinPrepare throws an exception, it would be from the 
rebalance listener.
               // next time we would then not retry {@code onJoinPrepare} any 
more but proceed the join-group procedure.
               needsJoinPrepare = false;
               throw e;
       }
   }
   ```




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