dajac commented on code in PR #16145:
URL: https://github.com/apache/kafka/pull/16145#discussion_r1622897443


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ConsumerGroup.java:
##########
@@ -832,7 +855,20 @@ public void validateOffsetFetch(
             throw new UnknownMemberIdException(String.format("Member %s is not 
a member of group %s.",
                 memberId, groupId));
         }
-        validateMemberEpoch(memberEpoch, member.memberEpoch());
+
+        if (member.useClassicProtocol()) {
+            try {
+                validateMemberEpoch(memberEpoch, member.memberEpoch());
+            } catch (StaleMemberEpochException ex) {
+                // StaleMemberEpochException is not supported in the classic 
protocol. We throw
+                // IllegalGenerationException instead for compatibility.
+                throw new IllegalGenerationException(String.format("Invalid 
offset commit because the "

Review Comment:
   nit: `offset fetch`.



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ConsumerGroup.java:
##########
@@ -832,7 +855,20 @@ public void validateOffsetFetch(
             throw new UnknownMemberIdException(String.format("Member %s is not 
a member of group %s.",
                 memberId, groupId));
         }
-        validateMemberEpoch(memberEpoch, member.memberEpoch());
+
+        if (member.useClassicProtocol()) {
+            try {
+                validateMemberEpoch(memberEpoch, member.memberEpoch());
+            } catch (StaleMemberEpochException ex) {
+                // StaleMemberEpochException is not supported in the classic 
protocol. We throw
+                // IllegalGenerationException instead for compatibility.
+                throw new IllegalGenerationException(String.format("Invalid 
offset commit because the "

Review Comment:
   I actually wonder if we could reuse the code too. We could define an helper 
method which takes the member, the received epoch and the source (e.g. offset 
commit or offset fetch). What do you think?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to