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

Yun Tang commented on FLINK-11948:
----------------------------------

[~bf30075] I think the name {{FlinkFixedPartitioner}} should already tell you 
that this partitioner is not round-robin but a fixed one. What's more, I think 
the default behavior is no {{FlinkKafkaPartitioner}} and will use Kafka's 
{{org.apache.kafka.clients.producer.internals.DefaultPartitioner}} to partition 
index.

If you think the implementation of {{FlinkFixedPartitioner}} contains some bug, 
this is just a trade-off and target for fixed partition.
 If you want to add a round-robin partitioner, please refer to FLINK-9610

> When kafka sink parallelism<kafka partition num,kafka data distribution 
> unbalance
> ---------------------------------------------------------------------------------
>
>                 Key: FLINK-11948
>                 URL: https://issues.apache.org/jira/browse/FLINK-11948
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Kafka
>    Affects Versions: 1.6.3, 1.6.4, 1.7.2
>            Reporter: qi quan
>            Priority: Major
>
> The default FlinkFixedPartitioner return  int[] partitions by subtaskid % 
> partitions.length.When kafka sink parallelism<kafka partition num。It only the 
> first few kafka partitions will write data.
> I think it needs to be improved here.
> {code:java}
>       @Override
>       public int partition(T record, byte[] key, byte[] value, String 
> targetTopic, int[] partitions) {
>               Preconditions.checkArgument(
>                       partitions != null && partitions.length > 0,
>                       "Partitions of the target topic is empty.");
>               return partitions[parallelInstanceId % partitions.length];
>       }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to