David Jacot created KAFKA-21681:
-----------------------------------
Summary: Classic group rejects a static member that restarts with
GROUP_MAX_SIZE_REACHED when the group is full
Key: KAFKA-21681
URL: https://issues.apache.org/jira/browse/KAFKA-21681
Project: Kafka
Issue Type: Bug
Reporter: David Jacot
When a static member of a classic group restarts, it sends a JoinGroup with its
group.instance.id and an empty member id.
GroupMetadataManager#classicGroupJoinToClassicGroup calls
acceptJoiningMember(group, memberId) before it looks at the instance id, and
acceptJoiningMember only checks the member id:
* In Stable and CompletingRebalance, it accepts a member that isn't in the
group only if group.numMembers() < group.max.size.
* In PreparingRebalance, it accepts it only if group.numAwaitingJoinResponse()
< group.max.size.
So when the group is full, the restarted member is rejected with
GROUP_MAX_SIZE_REACHED, although it would replace its old member
(classicGroupJoinNewStaticMember) and the group wouldn't grow.
Consumer groups don't have this problem: throwIfConsumerGroupIsFull skips the
check when group.hasStaticMember(instanceId), for the ConsumerGroupHeartbeat
and for a classic JoinGroup to a consumer group (KAFKA-20601). The old
coordinator had the same problem since static membership was added in 2.3: its
size check only looked at the member id too
(GroupCoordinator#acceptJoiningMember in 3.9), so this isn't a regression of
the new coordinator.
Impact:
* The classic consumer treats GROUP_MAX_SIZE_REACHED as fatal:
AbstractCoordinator raises GroupMaxSizeReachedException, and poll() throws it.
* The member can only rejoin after the session of the old member expires and
frees a slot.
*Steps to reproduce*
# Set group.max.size=2.
# Start two classic consumers with group.instance.id instance-1 and instance-2,
and wait for the group to be stable.
# Kill the second consumer, then start a new consumer with group.instance.id
instance-2 before the old member's session expires.
# The JoinGroup of the new consumer gets GROUP_MAX_SIZE_REACHED, and its poll()
throws GroupMaxSizeReachedException.
*Expected:* a JoinGroup whose group.instance.id belongs to a static member of
the group is accepted whatever the group size, as in consumer groups: the new
member replaces the old one, and the group doesn't grow.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)