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

ASF GitHub Bot commented on FLINK-10820:
----------------------------------------

zhijiangW commented on a change in pull request #7051: [FLINK-10820][network] 
Simplify the RebalancePartitioner implementation
URL: https://github.com/apache/flink/pull/7051#discussion_r236283310
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/api/writer/RecordWriterTest.java
 ##########
 @@ -412,23 +412,24 @@ public void testBroadcastEmitRecord() throws Exception {
         *
         * @param isBroadcastEmit whether using {@link 
RecordWriter#broadcastEmit(IOReadableWritable)} or not
         */
+       @SuppressWarnings("unchecked")
        private void 
emitRecordWithBroadcastPartitionerOrBroadcastEmitRecord(boolean 
isBroadcastEmit) throws Exception {
                final int numChannels = 4;
                final int bufferSize = 32;
                final int numValues = 8;
                final int serializationLength = 4;
 
-               @SuppressWarnings("unchecked")
                final Queue<BufferConsumer>[] queues = new Queue[numChannels];
                for (int i = 0; i < numChannels; i++) {
                        queues[i] = new ArrayDeque<>();
                }
 
                final TestPooledBufferProvider bufferProvider = new 
TestPooledBufferProvider(Integer.MAX_VALUE, bufferSize);
                final ResultPartitionWriter partitionWriter = new 
CollectingPartitionWriter(queues, bufferProvider);
+               final ChannelSelector selector = new Broadcast<>();
+               selector.setup(numChannels);
 
 Review comment:
   Yeah, it is useless code. I would remove it.

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


> Simplify the RebalancePartitioner implementation
> ------------------------------------------------
>
>                 Key: FLINK-10820
>                 URL: https://issues.apache.org/jira/browse/FLINK-10820
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Network
>    Affects Versions: 1.8.0
>            Reporter: zhijiang
>            Assignee: zhijiang
>            Priority: Minor
>              Labels: pull-request-available
>
> _The current {{RebalancePartitioner}} implementation seems a little hacky for 
> selecting a random number as the first channel index, and the following 
> selections based on this random index in round-robin fashion._
> _Especially for the corner case of {{numChannels = Integer.MAX_VALUE}}, it 
> would trigger next random index once reaching the last channel index. 
> Actually the random index should be selected only once at the first time._



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

Reply via email to