flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From greghogan <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2897] [runtime] Use distinct initial in...
Date Mon, 07 Dec 2015 14:51:05 GMT
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1292#discussion_r46828124
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/operators/shipping/OutputEmitter.java
---
    @@ -143,16 +148,24 @@ public OutputEmitter(ShipStrategyType strategy, TypeComparator<T>
comparator, Pa
     	
     	// --------------------------------------------------------------------------------------------
     
    +	private int[] forward() {
    +		return this.channels;
    +	}
    +
     	private int[] robin(int numberOfChannels) {
    -		if (this.channels == null || this.channels.length != 1) {
    -			this.channels = new int[1];
    +		int nextChannel = this.nextChannelToSendTo;
    +
    +		if (nextChannel >= numberOfChannels) {
    +			if (nextChannel == numberOfChannels) {
    +				nextChannel = 0;
    --- End diff --
    
    The modulo computation is executed in two cases: 1) the initial call to robin when the
source parallelism is greater than the receiver parallelism and 2) when the receiver parallelism
is dynamically changing.
    
    Unoptimized modulo is much slower than a test for equality but is required in the first
case to evenly distribute the first outputs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message