ableegoldman commented on a change in pull request #8445:
URL: https://github.com/apache/kafka/pull/8445#discussion_r414919285



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -1209,9 +1227,18 @@ public void handle(OffsetCommitResponse commitResponse, 
RequestFuture<Void> futu
                             return;
                         } else if (error == Errors.UNKNOWN_MEMBER_ID
                                 || error == Errors.ILLEGAL_GENERATION) {
-                            // need to reset generation and re-join group
-                            
resetGenerationOnResponseError(ApiKeys.OFFSET_COMMIT, error);
-                            future.raise(new CommitFailedException());
+                            log.info("OffsetCommit failed with {}: {}", 
sentGeneration, error.message());
+
+                            // only need to reset generation and re-join group 
if generation has not changed;
+                            // otherwise only raise rebalance-in-progress error
+                            if (generationUnchanged()) {
+                                
resetGenerationOnResponseError(ApiKeys.OFFSET_COMMIT, error);
+                                future.raise(new CommitFailedException());
+                            } else {
+                                future.raise(new 
RebalanceInProgressException("Offset commit cannot be completed since the " +

Review comment:
       Chatted about this offline, will just leave the concrete proposal here:
   ```
   ...
   } else {
       if (state == MemberState.REBALANCING) {
           future.raise(new RebalanceInProgressException(...)
       } else {
           future.raise(new CommitFailedException(...)
       }
   }
   ```
   




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to