This is an automated email from the ASF dual-hosted git repository.

jeagles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tez.git


The following commit(s) were added to refs/heads/master by this push:
     new 76b96fc  TEZ-4026. Fetch Download rate shows 0.0 MB per second if 
duration is 0 millis
76b96fc is described below

commit 76b96fca8f5a70ecce902740e3673d100a029fca
Author: Jonathan Eagles <[email protected]>
AuthorDate: Wed Feb 5 11:03:15 2020 -0600

    TEZ-4026. Fetch Download rate shows 0.0 MB per second if duration is 0 
millis
---
 .../runtime/library/common/shuffle/ShuffleUtils.java    | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/ShuffleUtils.java
 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/ShuffleUtils.java
index 1482a12..40909d4 100644
--- 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/ShuffleUtils.java
+++ 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/ShuffleUtils.java
@@ -567,15 +567,14 @@ public class ShuffleUtils {
       if (activeLogger.isInfoEnabled()) {
         long wholeMBs = 0;
         long partialMBs = 0;
-        if (millis != 0) {
-          // fast math is done using integer math to avoid double to string 
conversion
-          // calculate B/s * 100 to preserve MBs precision to two decimal 
places
-          // multiply numerator by 100000 (2^5 * 5^5) and divide denominator 
by MB (2^20)
-          // simply fraction to protect ourselves from overflow by factoring 
out 2^5
-          wholeMBs = (bytesCompressed * 3125) / (millis * 32768);
-          partialMBs = wholeMBs % 100;
-          wholeMBs /= 100;
-        }
+        millis = Math.max(1L, millis);
+        // fast math is done using integer math to avoid double to string 
conversion
+        // calculate B/s * 100 to preserve MBs precision to two decimal places
+        // multiply numerator by 100000 (2^5 * 5^5) and divide denominator by 
MB (2^20)
+        // simply fraction to protect ourselves from overflow by factoring out 
2^5
+        wholeMBs = (bytesCompressed * 3125) / (millis * 32768);
+        partialMBs = wholeMBs % 100;
+        wholeMBs /= 100;
         StringBuilder sb = new StringBuilder("Completed fetch for attempt: ");
         toShortString(srcAttemptIdentifier, sb);
         sb.append(" to ");

Reply via email to