Guibo-Pan commented on a change in pull request #6544: [FLINK-8532] [Streaming] 
modify RebalancePartitioner to use a random partition as its first partition
URL: https://github.com/apache/flink/pull/6544#discussion_r209612423
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/partitioner/RebalancePartitioner.java
 ##########
 @@ -36,9 +38,13 @@
        @Override
        public int[] selectChannels(SerializationDelegate<StreamRecord<T>> 
record,
                        int numberOfOutputChannels) {
-               int newChannel = ++this.returnArray[0];
-               if (newChannel >= numberOfOutputChannels) {
-                       this.returnArray[0] = 0;
+               if (this.returnArray[0] < 0) {
+                       this.returnArray[0] = new 
Random().nextInt(numberOfOutputChannels);
 
 Review comment:
   Thanks for your suggestion, and I am going to commit an update.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to