Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-13 Thread via GitHub


mjsax merged PR #15519:
URL: https://github.com/apache/kafka/pull/15519


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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-12 Thread via GitHub


mjsax commented on PR #15519:
URL: https://github.com/apache/kafka/pull/15519#issuecomment-1992854817

   PR update does not show up right now. Github Status page:
   > Update - We're continuing to investigate an elevated number of pull 
requests that are out of sync on page load.
   Mar 13, 2024 - 00:12 UTC
   
   Just in case you are wondering.


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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-12 Thread via GitHub


mjsax commented on PR #15519:
URL: https://github.com/apache/kafka/pull/15519#issuecomment-1992841168

   Thank for all the input! -- Updated the PR accordinly.


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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-12 Thread via GitHub


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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-12 Thread via GitHub


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


##
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:
   The field is at minimum also required in the first request too. Overall, I 
think that we should just set it all the time if `groupInstanceId` is defined. 
This is actually was the server expects in the current implementation. We may 
be able to relax this requirement in the future though.



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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-11 Thread via GitHub


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


##
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:
   It is never read after this PR, so I feel it is safe to remove it. 
Otherwise, that will result in another warning about "never read".



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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-11 Thread via GitHub


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


##
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:
   I don't understand enough about this part of the code to judge...



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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-11 Thread via GitHub


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


##
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:
   it seems `sentFields.instanceId` is useless after this PR. maybe we should 
remove it?



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



Re: [PR] MINOR: simplify consumer logic [kafka]

2024-03-11 Thread via GitHub


mjsax commented on PR #15519:
URL: https://github.com/apache/kafka/pull/15519#issuecomment-1989525897

   Follow up from https://github.com/apache/kafka/pull/15419/files#r1513841644


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