You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/08/23 19:04:20 UTC

[GitHub] Guibo-Pan edited a comment on issue #6544: [FLINK-8532] [Streaming] modify RebalancePartitioner to use a random partition as its first partition

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:
users@infra.apache.org


With regards,
Apache Git Services