[
https://issues.apache.org/jira/browse/KAFKA-21645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Jacot resolved KAFKA-21645.
---------------------------------
Fix Version/s: 4.5.0
4.4.1
4.3.3
Resolution: Fixed
> Classic to consumer group conversion can assign a partition to two members
> --------------------------------------------------------------------------
>
> Key: KAFKA-21645
> URL: https://issues.apache.org/jira/browse/KAFKA-21645
> Project: Kafka
> Issue Type: Bug
> Affects Versions: 4.0.0
> Reporter: David Jacot
> Assignee: David Jacot
> Priority: Major
> Fix For: 4.5.0, 4.4.1, 4.3.3
>
>
> When a classic group is converted to a consumer group during a rebalance that
> started in CompletingRebalance, the converted members own no partitions, even
> though cooperative members still consume theirs. The first target assignment
> of the consumer group then gives those partitions to other members, so two
> members consume the same partitions until the old owners rejoin and revoke
> them.
> A rebalance starts in CompletingRebalance, for example, when a member joins
> or leaves before the leader sends its SyncGroup, or when the write of the
> leader's assignment fails. The group coordinator then sets the in-memory
> assignment of every member to empty, and it stays empty until the next
> SyncGroup of the leader, even across the next join phase. The reset is never
> written to the log, and cooperative members keep their partitions meanwhile.
> {{ConsumerGroup.fromClassicGroup}} builds the assigned partitions and the
> target assignment of each member from these empty assignments.
> Steps to reproduce, with group.consumer.migration.policy=upgrade or
> bidirectional:
> # Two classic consumers using cooperative-sticky own partitions of a topic at
> generation 1.
> # A third classic consumer joins. The join phase completes, and the group
> waits in CompletingRebalance for the SyncGroup of the leader.
> # A fourth classic consumer joins before that SyncGroup, which starts a new
> rebalance.
> # Before the leader's next SyncGroup, a consumer with group.protocol=consumer
> joins the group, which converts it to a consumer group.
> # The new consumer, or another member, is assigned partitions that the first
> two consumers still consume.
> Impact:
> * For a short window, two consumers process the same partitions. The window
> ends when the old owners rejoin at their next poll() and revoke the
> partitions, so it lasts up to one poll loop, bounded by max.poll.interval.ms.
> * At-least-once applications process records twice. When the old owners
> revoke the partitions, their commits in onPartitionsRevoked are accepted and
> can overwrite the offsets of the new owners.
> * Exactly-once applications lose the guarantee during the window, because the
> old owners are not fenced.
> * Only cooperative members are affected. Eager members give up their
> partitions before they rejoin.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)