Deng Ziming created KAFKA-15354:
-----------------------------------

             Summary: Partition leader is not evenly distributed in kraft mode
                 Key: KAFKA-15354
                 URL: https://issues.apache.org/jira/browse/KAFKA-15354
             Project: Kafka
          Issue Type: Improvement
            Reporter: Deng Ziming


In StripedReplicaPlacerTest, we can create a test below to reproduce this bug.
{code:java}
// code placeholder
@Test
public void testReplicaDistribution() {
    MockRandom random = new MockRandom();
    StripedReplicaPlacer placer = new StripedReplicaPlacer(random);
    TopicAssignment assignment = place(placer, 0, 4, (short) 2, Arrays.asList(
            new UsableBroker(0, Optional.of("0"), false),
            new UsableBroker(1, Optional.of("0"), false),
            new UsableBroker(2, Optional.of("1"), false),
            new UsableBroker(3, Optional.of("1"), false)));
    System.out.println(assignment);
} {code}
In StripedReplicaPlacer, we only ensure leader are distributed evenly across 
racks, but we didn't ensure leader are evenly distributed across nodes. in the 
test above, we have 4 node: 1 2 3 4, and create 4 partitions but the leaders 
areĀ  1 2 1 2. while in zk mode, this is ensured, see 
https://cwiki.apache.org/confluence/display/KAFKA/KIP-36+Rack+aware+replica+assignment



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to