[
https://issues.apache.org/jira/browse/KAFKA-21489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18145426#comment-18145426
]
Luke Chen commented on KAFKA-21489:
-----------------------------------
There is a strimzi user encountering similar issue, and the reproduce steps
using Kafka v4.3.0 is here:
[https://github.com/strimzi/strimzi-kafka-operator/issues/13286#issuecomment-6890825470]
.
> CreatePartitions uses an inflated replication factor while a partition of the
> topic is being reassigned
> -------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-21489
> URL: https://issues.apache.org/jira/browse/KAFKA-21489
> Project: Kafka
> Issue Type: Bug
> Components: controller
> Affects Versions: 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0
> Reporter: Eric Chang
> Assignee: Eric Chang
> Priority: Major
>
> In KRaft, {{ReplicationControlManager.createPartitions}} takes the
> replication factor from the length of an existing partition's {{replicas}}
> array. During a reassignment, this array holds both the target replicas and
> the replicas being removed. If that partition is being reassigned, new
> partitions get more replicas than the topic should have.
> Steps to reproduce (unit test in {{ReplicationControlManagerTest}}):
> # Create a topic with one partition and replicas [0, 1].
> # Start a reassignment of partition 0 to [2, 3] and do not complete it. The
> replicas of partition 0 become [2, 3, 0, 1].
> # Call {{createPartitions}} to add one partition without a manual assignment.
> The new partition gets 4 replicas instead of 2.
> # Call {{createPartitions}} with a manual assignment of 2 replicas. The
> request fails with {{INVALID_REPLICA_ASSIGNMENT}}.
> Background:
> In ZooKeeper mode, {{ZkAdminManager}} rejected CreatePartitions with
> {{REASSIGNMENT_IN_PROGRESS}} while the topic was being reassigned. KIP-195
> lists this error, and KAFKA-9038 limited the check to the topic in the
> request. The KRaft controller does not have this check.
> Possible fixes:
> * Reject CreatePartitions with {{REASSIGNMENT_IN_PROGRESS}} when any
> partition of the topic is being reassigned. This matches the ZooKeeper
> behavior.
> * Compute the replication factor without the removing replicas
> ({{replicas.length - removingReplicas.length}}).
> Related: KAFKA-21252
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)