hachikuji commented on a change in pull request #11231:
URL: https://github.com/apache/kafka/pull/11231#discussion_r691522435



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
##########
@@ -476,7 +476,6 @@ boolean joinGroupIfNeeded(final Timer timer) {
                 else if (!future.isRetriable())
                     throw exception;
 
-                resetStateAndRejoin(String.format("rebalance failed with 
retriable error %s", exception));

Review comment:
       My reasoning here is the following. First, there is no reason to reset 
the memberId/generation if it is a retriable error. For most transient errors, 
our session timeout will not have expired, so it is better to rejoin with the 
same memberId. This ensures that we will not have an extra delay while the old 
memberId gets expired. On the other hand, if the session timeout _did_ expire, 
then our next `JoinGroup` will fail with `UNKNOWN_MEMBER_ID`, which will cause 
our state to be reset in the `JoinGroupResponseHandler`.
   
   Second, there should be no need to reset the `rejoinNeeded` flag. Once we 
begin a rebalance, this will remain set to `true` until the `SyncGroup` 
completes successfully which consequently causes the future to be completed 
successfully. Hence there's no way that I can see for `rejoinNeeded` to be 
`false` if the future has failed.




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