Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-9965

Uneven distribution with RoundRobinPartitioner in AK 2.4+

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.4.0, 2.5.0, 2.4.1
    • None
    • producer
    • None

    Description

      RoundRobinPartitioner states that it will provide equal distribution of records across partitions. However with the enhancements made in KIP-480, it may not. In some cases, when a new batch is started, the partitioner may be called a second time for the same record:

      https://github.com/apache/kafka/blob/2.4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L909

      https://github.com/apache/kafka/blob/2.4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L934

      Each time the partitioner is called, it increments a counter in RoundRobinPartitioner, so this can result in unequal distribution.

      Easiest fix might be to decrement the counter in RoundRobinPartitioner#onNewBatch.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mikebin Michael Bingham
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: