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

DefaultParitioner Implementation Issue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 0.9.0.1, 0.10.0.1
    • None
    • producer

    Description

      In DefaultPartitioner implementation, when key is null
      if (availablePartitions.size() > 0)

      { int part = Utils.toPositive(nextValue) % availablePartitions.size(); return availablePartitions.get(part).partition(); }

      Where as when key is not null
      return Utils.toPositive(Utils.murmur2(keyBytes)) % numPartitions;

      We are returning partition by using total number of partitions.
      Should n't we do the same as by considering only available partitions?

      https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/internals/DefaultPartitioner.java#L67

      Attachments

        Activity

          People

            bharat Bharat Viswanadham
            bharat Bharat Viswanadham
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: