1
0
Prechádzať zdrojové kódy

commit e5996a66b84b2d8b719100002d190c4b4898d4ca
Author: Mahadev Konar <mahadev@yahoo-inc.com>
Date: Fri Aug 6 13:54:48 2010 -0700

MAPREDUCE-1521. Fix overflow problem in the resource estimator. Mahadev Konar


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077647 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 rokov pred
rodič
commit
08778d3996

+ 3 - 1
src/mapred/org/apache/hadoop/mapred/ResourceEstimator.java

@@ -73,7 +73,9 @@ class ResourceEstimator {
     } else {
       long inputSize = job.getInputLength() + job.desiredMaps(); 
       //add desiredMaps() so that randomwriter case doesn't blow up
-      long estimate = Math.round((inputSize * 
+      //the multiplication might lead to overflow, casting it with
+      //double prevents it
+      long estimate = Math.round(((double)inputSize * 
           completedMapsOutputSize * 2.0)/completedMapsInputSize);
       if (LOG.isDebugEnabled()) {
         LOG.debug("estimate total map output will be " + estimate);