Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-5288

ResourceEstimator#getEstimatedTotalMapOutputSize suffers from divide by zero issues

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.3.0
    • Component/s: mrv1
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      The computation in the above mentioned class-method is below:

            long estimate = Math.round(((double)inputSize * 
                completedMapsOutputSize * 2.0)/completedMapsInputSize);
      

      Given http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#round(double), its possible that the returned estimate could be Long.MAX_VALUE if completedMapsInputSize is determined to be zero.

      This can be proven with a simple code snippet:

      class Foo {
          public static void main(String... args) {
              long inputSize = 600L + 2;
              long estimate = Math.round(((double)inputSize *
                                    1L * 2.0)/0L);
              System.out.println(estimate);
          }
      }
      

      The above conveniently prints out: 9223372036854775807, which is Long.MAX_VALUE (or 8 Exbibytes per MapReduce).

      1. mr-5288-1.patch
        5 kB
        Karthik Kambatla

        Activity

        Gavin made changes -
        Assignee Karthik Kambatla [ kkambatl ] Karthik Kambatla [ kasha ]
        Alejandro Abdelnur made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags Reviewed [ 10343 ]
        Fix Version/s 1.3.0 [ 12324153 ]
        Resolution Fixed [ 1 ]
        Karthik Kambatla (Inactive) made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Karthik Kambatla (Inactive) made changes -
        Attachment mr-5288-1.patch [ 12586371 ]
        Karthik Kambatla (Inactive) made changes -
        Field Original Value New Value
        Assignee Karthik Kambatla [ kkambatl ]
        Harsh J created issue -

          People

          • Assignee:
            Karthik Kambatla
            Reporter:
            Harsh J
          • Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development