suzhiking commented on code in PR #23266:
URL: https://github.com/apache/kafka/pull/23266#discussion_r3916951419
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java:
##########
@@ -1180,7 +1177,13 @@ public synchronized RequestFuture<Void>
maybeLeaveGroup(CloseOptions.GroupMember
client.pollNoWakeup();
}
- resetGenerationOnLeaveGroup();
+ // A static member whose LeaveGroup is suppressed stays registered
with the group
+ // coordinator under its current member id, so keep the id locally as
well: resetting
+ // it would make the next rejoin carry UNKNOWN_MEMBER_ID, which the
coordinator must
+ // treat as a new instance claiming this group.instance.id, fencing
any still-pending
+ // join attempt of this same consumer (KAFKA-20985). State and
generation are reset
+ // and a rejoin is requested exactly as before.
+ resetStateAndRejoin("consumer pro-actively leaving the group",
shouldSendLeaveGroup || isDynamicMember());
Review Comment:
agree, but `resetStateAndRejoin` takes `shouldResetMemberId`, so instead I
did
```
boolean shouldResetMemberId = shouldSendLeaveGroup || isDynamicMember();
resetStateAndRejoin("consumer pro-actively leaving the group",
shouldResetMemberId);
```
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinatorTest.java:
##########
@@ -1142,6 +1143,33 @@ private static Stream<Arguments>
groupInstanceIdAndMembershipOperationMatrix() {
);
}
+ @Test
+ public void testStaticMemberKeepsMemberIdWhenLeaveGroupIsSuppressed() {
Review Comment:
Make sense, I'll add that
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java:
##########
@@ -1180,7 +1177,13 @@ public synchronized RequestFuture<Void>
maybeLeaveGroup(CloseOptions.GroupMember
client.pollNoWakeup();
}
- resetGenerationOnLeaveGroup();
+ // A static member whose LeaveGroup is suppressed stays registered
with the group
Review Comment:
done
--
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]