FrankYang0529 commented on code in PR #19856:
URL: https://github.com/apache/kafka/pull/19856#discussion_r2123571086


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerHeartbeatRequestManager.java:
##########
@@ -306,6 +307,13 @@ public ConsumerGroupHeartbeatRequestData 
buildRequestData() {
                 sentFields.localAssignment = local;
             }
 
+            // RackId - sent when joining or if it has changed since the last 
heartbeat
+            String rackId = membershipManager.rackId().orElse(null);
+            if (sendAllFields || !Objects.equals(rackId, sentFields.rackId)) {
+                data.setRackId(rackId);
+                sentFields.rackId = rackId;
+            }

Review Comment:
   Added related test `testRackIdInHeartbeatLifecycle`. BTW, I remove `rackId` 
from `sentFields`. Users cannot reconfigure it, so we don't need to keep last 
sent data in `sentFields`.



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