chickenchickenlove commented on code in PR #22245:
URL: https://github.com/apache/kafka/pull/22245#discussion_r3324496324


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -4091,9 +4276,17 @@ private UpdateTargetAssignmentResult<TasksTuple> 
maybeUpdateStreamsTargetAssignm
                 .withMetadataImage(metadataImage)
                 .withTargetAssignment(group.targetAssignment());
 
-            updatedMember.ifPresent(member ->
-                assignmentResultBuilder.addOrUpdateMember(member.memberId(), 
member)
-            );
+            updatedMember.ifPresent(member -> {
+                assignmentResultBuilder.addOrUpdateMember(member.memberId(), 
member);
+                // If the instance id was associated to a different member, it 
means that the
+                // static member is replaced by the current member hence we 
remove the previous one.
+                member.instanceId().ifPresent(instanceId -> {
+                    StreamsGroupMember previousMember = 
group.staticMember(instanceId);
+                    if (previousMember != null && 
!member.memberId().equals(previousMember.memberId())) {
+                        
assignmentResultBuilder.removeMember(previousMember.memberId());
+                    }
+                });
+            });

Review Comment:
   @squah-confluent , About 
https://github.com/apache/kafka/pull/22245#issuecomment-4573880838
   
   I think this code block seems cover it. 
   What do you think?
   
   Would it be better to mirror the ConsumerGroup behavior here?



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