[FLINK-6586] InputGateMetrics return 0 as min for local channels

Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/c3ab5c82
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/c3ab5c82
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/c3ab5c82

Branch: refs/heads/release-1.3
Commit: c3ab5c8253b32bddc3fb9bf0c1085813e7f97e2f
Parents: 5d1cda5
Author: zentol <[email protected]>
Authored: Mon May 15 13:56:06 2017 +0200
Committer: zentol <[email protected]>
Committed: Fri May 19 21:09:08 2017 +0200

----------------------------------------------------------------------
 .../io/network/partition/consumer/InputGateMetrics.java       | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/c3ab5c82/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java
----------------------------------------------------------------------
diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java
 
b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java
index 796a6db..69af455 100644
--- 
a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java
+++ 
b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java
@@ -72,10 +72,6 @@ public class InputGateMetrics {
                int min = Integer.MAX_VALUE;
 
                Collection<InputChannel> channels = 
inputGate.getInputChannels().values();
-               if (channels.isEmpty()) {
-                       // meaningful value when no channels exist:
-                       return 0;
-               }
 
                for (InputChannel channel : channels) {
                        if (channel instanceof RemoteInputChannel) {
@@ -86,6 +82,9 @@ public class InputGateMetrics {
                        }
                }
 
+               if (min == Integer.MAX_VALUE) { // in case all channels are 
local, or the channel collection was empty
+                       return 0;
+               }
                return min;
        }
 

Reply via email to