You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by je...@apache.org on 2020/02/05 17:05:55 UTC

[tez] branch branch-0.9 updated: TEZ-4026. Fetch Download rate shows 0.0 MB per second if duration is 0 millis

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

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


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

commit 18f344cb19273139f4aaf5cc568cbdf511b3ccda
Author: Jonathan Eagles <je...@apache.org>
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
    
    (cherry picked from commit 76b96fca8f5a70ecce902740e3673d100a029fca)
---
 .../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 63afae1..1b93c91 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
@@ -566,15 +566,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 ");