lucasbru commented on code in PR #24195:
URL: https://github.com/apache/kafka/pull/24195#discussion_r4564072829
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -4734,6 +4734,26 @@ private Map<String, TasksTuple> refineAssignment(
return refinedAssignment;
}
+ /**
+ * Whether the intermediate assignment differs from the assigned tasks of
any member of the group.
Review Comment:
This reads the replayed `group.members()`, so it doesn't see this
heartbeat's `updatedMember`, nor a static-member replacement whose records are
queued but not replayed yet. As far as I can tell that's fine today, but only
because the call site is gated on `STABLE`: a replaced or rejoining static
member has to have left first, and its epoch -2 keeps the group out of
`STABLE`. The `NONE` check alone wouldn't exclude it, since the static-member
metadata check ignores the new member id. Could we state that precondition in
the Javadoc, so it doesn't silently break if the gate changes?
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/StreamsGroupStaticMemberGroupMetadataManagerTest.java:
##########
@@ -2504,4 +2520,201 @@ private static
StreamsGroupHeartbeatResponseData.TopicPartition topicPartition(S
return new
StreamsGroupHeartbeatResponseData.TopicPartition().setTopic(topic).setPartitions(partitions);
}
+ @Test
+ public void
testStaticMemberBounceAfterRefinementOnUninvolvedMemberHeartbeat() {
Review Comment:
Both tests would fail without the fix, but the epoch bump itself is only
asserted inside the shared setup helper (`assertEquals(12,
group.groupEpoch())`). The bump is triggered by memberA, a dynamic member, so a
regression would surface as a failure in the static-bounce tests. Would you
consider a small separate test asserting that a heartbeat from an uninvolved
member bumps the epoch, and that the involved member is then told to release or
take over the task? That would make a failure point at the actual cause.
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/AssignmentRefiner.java:
##########
@@ -104,7 +104,8 @@ static boolean preservesActiveTaskCount(
Map<String, TasksTuple> targetAssignment,
Map<String, TasksTuple> refinedAssignment
) {
- return countActiveTasks(targetAssignment) ==
countActiveTasks(refinedAssignment);
+ return targetAssignment == refinedAssignment
Review Comment:
This looks behavior-neutral, since the same instance always has equal
counts. Is it meant as a fast path for a refiner that returns the target map
unchanged? If so, it's unrelated to the epoch-bump fix, so should it be in this
PR? If we keep it, a short comment saying why would help.
--
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]