[
https://issues.apache.org/jira/browse/KAFKA-21582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sean Quah resolved KAFKA-21582.
-------------------------------
Resolution: Fixed
> Upgrading a classic group during a rebalance does not trigger a new target
> assignment when the upgrading member does not bump the group epoch
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-21582
> URL: https://issues.apache.org/jira/browse/KAFKA-21582
> Project: Kafka
> Issue Type: Bug
> Components: group-coordinator
> Affects Versions: 4.0.0
> Reporter: Sean Quah
> Assignee: Sean Quah
> Priority: Major
> Fix For: 4.5.0, 4.4.1, 4.3.3
>
>
> {{ConsumerGroup#fromClassicGroup}} sets the group epoch and the target
> assignment epoch to the classic group's generation, and it takes the previous
> generation's assignments as the target assignment. When the classic group is
> in PreparingRebalance or CompletingRebalance, it is waiting for a new
> assignment, so these values are stale. The upgrade is supposed to get a fresh
> assignment from the epoch bump caused by the joining member. When the member
> that triggers the upgrade does not bump the epoch, the coordinator treats the
> stale target assignment as up to date. Two such members are:
> * A consumer-protocol static member that replaces a classic static member
> with the same subscription.
> * A new consumer-protocol member that subscribes with a regex that resolves
> to no topics. A new regex does not bump the group epoch until it is resolved,
> and resolving it to no topics does not bump it either.
> *Steps to reproduce (static member replacement)*
> # Set {{group.consumer.migration.policy}} to {{{}upgrade{}}}, and set
> {{group.initial.rebalance.delay.ms}} high enough that the classic group's
> initial rebalance doesn't complete during the test.
> # A classic static member with {{group.instance.id}} X joins a new group G.
> The group goes to PreparingRebalance at generation 0 and the JoinGroup stays
> pending.
> # Before the initial rebalance completes, a consumer-protocol member with a
> new member id sends ConsumerGroupHeartbeat to G with member epoch 0,
> {{instanceId}} X, and the same subscription as the classic member.
> # The coordinator upgrades G to a consumer group at group epoch 0 and target
> assignment epoch 0. The consumer member replaces the classic static member
> and is reset to epoch 0.
> # The subscription is unchanged, so the group epoch isn't bumped. The
> coordinator considers the target assignment at epoch 0 up to date, and
> reconciles the new member to it.
> # The heartbeat response returns member epoch 0.
> *Steps to reproduce (regex that resolves to no topics)*
> # Set {{group.consumer.migration.policy}} to {{{}upgrade{}}}, and set
> {{group.initial.rebalance.delay.ms}} high enough that the classic group's
> initial rebalance doesn't complete during the test.
> # A classic member joins a new group G. The group goes to PreparingRebalance
> at generation 0 and the JoinGroup stays pending.
> # Before the initial rebalance completes, a consumer-protocol member with a
> new member id sends ConsumerGroupHeartbeat to G with member epoch 0 and a
> {{subscribedTopicRegex}} that matches no topic.
> # The coordinator upgrades G to a consumer group at group epoch 0 and target
> assignment epoch 0. The new member's regex is not resolved yet, so its join
> doesn't bump the group epoch.
> # The coordinator considers the target assignment at epoch 0 up to date, and
> reconciles the new member to it. The heartbeat response returns member epoch
> 0.
> # The regex resolves to no topics, which doesn't bump the group epoch either.
> *Expected:* the upgrade triggers a new target assignment, and the members get
> an epoch greater than 0. Epoch 0 is reserved for members joining a group.
> When the group has completed at least one generation, the same sequences
> return a valid epoch, but the members keep the previous generation's target
> assignment, which may be empty for members that joined during the rebalance.
> Partitions stay unassigned or keep their old owners until an unrelated epoch
> bump. With the regex, no later event from the upgrading member bumps the
> epoch, so the group can stay on the stale assignment indefinitely.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)