[ 
https://issues.apache.org/jira/browse/KAFKA-4402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15662153#comment-15662153
 ] 

Ewen Cheslack-Postava commented on KAFKA-4402:
----------------------------------------------

[~Jun Yao] Which code are you looking at for this? 
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/internals/DefaultPartitioner.java#L55-L64
 seems to have the right behavior since it uses a counter and modulo to select 
a partition when the bytes are null. It isn't perfect when the number of 
partitions change since it might have outdated metadata, but that is an edge 
case. Perhaps you were looking at the old DefaultPartitioner.scala for the old 
producer?

> Kafka Producer's DefaultPartitioner is actually not round robin as said in 
> the code comments "If no partition or key is present choose a partition in a 
> round-robin fashion"
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-4402
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4402
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Jun Yao
>            Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to