vamossagar12 commented on code in PR #14432:
URL: https://github.com/apache/kafka/pull/14432#discussion_r1383620879


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -731,6 +752,36 @@ private void throwIfConsumerGroupIsFull(
         }
     }
 
+    private void throwIfStaticMemberValidationFails(
+        String groupId,
+        String instanceId,
+        ConsumerGroupMember existingStaticMember,
+        int memberEpoch,
+        String memberId
+    ) {
+        if (memberEpoch != 0) {
+            // The member joined with a non-zero epoch but we haven't 
registered this static member
+            // This could be an unknown member for the coordinator.
+            if (existingStaticMember == null) {
+                throw Errors.UNKNOWN_MEMBER_ID.exception("No existing static 
member found against instance id: " +  instanceId);
+            }
+            // There already exists a different member id for the same 
instance id.
+            if (!existingStaticMember.memberId().equals(memberId)) {
+                log.info("Request memberId={} for static member with 
groupInstanceId={} " +
+                        "is fenced by existing memberId={}",
+                    memberId, instanceId, existingStaticMember.memberId());
+                throw Errors.FENCED_INSTANCE_ID.exception();

Review Comment:
   Added.



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