lianetm commented on code in PR #15519:
URL: https://github.com/apache/kafka/pull/15519#discussion_r1521497910


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -529,10 +529,9 @@ public ConsumerGroupHeartbeatRequestData 
buildRequestData() {
             // MemberEpoch - always sent
             data.setMemberEpoch(membershipManager.memberEpoch());
 
-            // InstanceId - only sent if has changed since the last heartbeat
-            // Always send when leaving the group as a static member
+            // InstanceId - send when leaving the group as a static member
             membershipManager.groupInstanceId().ifPresent(groupInstanceId -> {
-                if (!groupInstanceId.equals(sentFields.instanceId) || 
membershipManager.memberEpoch() == 
ConsumerGroupHeartbeatRequest.LEAVE_GROUP_STATIC_MEMBER_EPOCH) {
+                if (membershipManager.memberEpoch() == 
ConsumerGroupHeartbeatRequest.LEAVE_GROUP_STATIC_MEMBER_EPOCH) {
                     data.setInstanceId(groupInstanceId);
                     sentFields.instanceId = groupInstanceId;

Review Comment:
   Agree we could simplify and remove the `instanceId` from the `sentFields` 
like @chia7712 suggested. I don't see the need to track it as it's not 
something that will change and we just simply need to send the value we have. 



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -529,10 +529,9 @@ public ConsumerGroupHeartbeatRequestData 
buildRequestData() {
             // MemberEpoch - always sent
             data.setMemberEpoch(membershipManager.memberEpoch());
 
-            // InstanceId - only sent if has changed since the last heartbeat
-            // Always send when leaving the group as a static member
+            // InstanceId - send when leaving the group as a static member
             membershipManager.groupInstanceId().ifPresent(groupInstanceId -> {

Review Comment:
   Agree, the current coordinator expectation seems to me like the right thing 
to do, and we should send the `groupInstanceId` all the time (in the same way 
that we send the `memberId` all the time). 



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