Guibo-Pan edited a comment on issue #6544: [FLINK-8532] [Streaming] modify 
RebalancePartitioner to use a random partition as its first partition
URL: https://github.com/apache/flink/pull/6544#issuecomment-415499383
 
 
   Hi @StephanEwen , your suggestion lead me to deep thinks, and the extreme 
performance is exactly what we want. I am going to ask you for more 
suggestions. I prefer to initialize the partitioner instance with a random 
partition, however in the design ahead, the partitioner doesn't know the target 
range.
   The alternative is like this:
   ```
   private final int[] returnArray = new int[] 
{ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE - 1)};
   
   @Override
   public int[] selectChannels(SerializationDelegate<StreamRecord<T>> record,
                int numberOfOutputChannels) {
        this.returnArray[0] = (this.returnArray[0] + 1) % 
numberOfOutputChannels;
        return this.returnArray;
   }
   ```
    Please tell me how you think, thanks.

----------------------------------------------------------------
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