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

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

pnowojski commented on a change in pull request #7199: [FLINK-10662][network] 
Refactor the ChannelSelector interface for single selected channel
URL: https://github.com/apache/flink/pull/7199#discussion_r240982674
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java
 ##########
 @@ -68,20 +68,29 @@
 
        private final boolean flushAlways;
 
+       private final boolean isBroadcastSelector;
+
        private Counter numBytesOut = new SimpleCounter();
 
        private Counter numBuffersOut = new SimpleCounter();
 
        public RecordWriter(ResultPartitionWriter writer) {
-               this(writer, new RoundRobinChannelSelector<T>());
+               this(writer, new RoundRobinChannelSelector<T>(), false);
        }
 
-       @SuppressWarnings("unchecked")
-       public RecordWriter(ResultPartitionWriter writer, ChannelSelector<T> 
channelSelector) {
-               this(writer, channelSelector, false);
+       public RecordWriter(
 
 Review comment:
   I'm not sure if I like the current approach of passing broadcasting 
`ChannelSelector` that is never being used and separate `boolean 
isBroadcastSelector` flag. It's redundant and can lead to errors (like passing 
non broadcasting selector with flag set to true or vice versa). I think it 
would be nice good to try out if this code can be refactored in one of the two 
ways:
   
   1. Adding some method like `boolean ChannelSelector::isBroadcast()` and use 
it in the `RecordWriter` constructor
   2.  Disallowing to pass both those parameters and changing the signature of 
this constructor to:
   ```
   RecordWriter(ResultPartitionWriter writer, boolean isBroadcast)
   ```
   
   Maybe there is also some other way around?

----------------------------------------------------------------
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:
[email protected]


> Refactor the ChannelSelector interface for single selected channel
> ------------------------------------------------------------------
>
>                 Key: FLINK-10662
>                 URL: https://issues.apache.org/jira/browse/FLINK-10662
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Network
>    Affects Versions: 1.5.4, 1.6.1
>            Reporter: zhijiang
>            Assignee: zhijiang
>            Priority: Minor
>              Labels: pull-request-available
>
> In the discussion of broadcast improvement, [~pnowojski] pointed out the 
> issue of improving the current channel selector.
>  
> In {{ChannelSelector#selectChannels}}, it would return an array for selected 
> channels. But considering specific implementations, only 
> {{BroadcastPartitioner}} would select all the channels, and other 
> implementations will select one channel. So we can simple this interface to 
> return single channel index for benefiting performance, and specialize the 
> {{BroadcastPartitioner}} in a more efficient way.



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

Reply via email to