[FLINK-6416] Fix divide-by-zero in InputGateMetrics

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

Branch: refs/heads/master
Commit: c995ebd290b04c6426deff5a515ab0d0f1246ac7
Parents: e03f1b5
Author: zentol <ches...@apache.org>
Authored: Mon May 15 13:44:54 2017 +0200
Committer: zentol <ches...@apache.org>
Committed: Thu May 18 17:44:15 2017 +0200

----------------------------------------------------------------------
 .../runtime/io/network/partition/consumer/InputGateMetrics.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/c995ebd2/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 c9fed9b..796a6db 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
@@ -130,7 +130,7 @@ public class InputGateMetrics {
                        }
                }
 
-               return total / (float) count;
+               return count == 0 ? 0 : total / (float) count;
        }
 
        // 
------------------------------------------------------------------------

Reply via email to