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

DefaultStreamPartitioner may get "stuck" to one partition for unkeyed messages

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4.0
    • 3.3.0
    • streams
    • None

    Description

      While working on KIP-794, I noticed that DefaultStreamPartitioner does not call .onNewBatch.  The "sticky" DefaultStreamPartitioner introduced as a result of https://issues.apache.org/jira/browse/KAFKA-8601 requires .onNewBatch call in order to switch to a new partitions for unkeyed messages, just calling .partition would return the same "sticky" partition chosen during the first call to .partition.  The partition doesn't change even if the partition leader is unavailable.

      Ideally, for unkeyed messages the DefaultStreamPartitioner should take advantage of the new built-in partitioning logic introduced in https://github.com/apache/kafka/pull/12049.  Perhaps, it could return null partition for unkeyed message, so that KafkaProducer could run built-in partitioning logic.

      Attachments

        Issue Links

          Activity

            People

              guozhang Guozhang Wang
              alivshits Artem Livshits
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: