Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-6076

Zero map split input length combine with none zero map split input length may cause MR1 job hung sometimes.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • mrv1
    • None
    • Reviewed

    Description

      Zero map split input length combine with none zero map split input length may cause MR1 job hung sometimes.
      This problem may happen when use HBASE input split(TableSplit).
      HBASE split input length can be zero for unknown regions or non-zero for known regions in the following code:

      // TableSplit.java
      public long getLength() {
          return length;
        }
      
      // RegionSizeCalculator.java
      public long getRegionSize(byte[] regionId) {
          Long size = sizeMap.get(regionId);
          if (size == null) {
            LOG.debug("Unknown region:" + Arrays.toString(regionId));
            return 0;
          } else {
            return size;
          }
        }
      

      The TableSplit length come from RegionSizeCalculator.getRegionSize.

      The job hung is because in MR1,
      If these zero split input length map tasks are scheduled and completed before all none zero split input length map tasks are scheduled,
      Scheduling new map task in JobProgress.java will be failed to pass the TaskTracker resources check at.

      // findNewMapTask
          // Check to ensure this TaskTracker has enough resources to 
          // run tasks from this job
          long outSize = resourceEstimator.getEstimatedMapOutputSize();
          long availSpace = tts.getResourceStatus().getAvailableSpace();
          if(availSpace < outSize) {
            LOG.warn("No room for map task. Node " + tts.getHost() + 
                     " has " + availSpace + 
                     " bytes free; but we expect map to take " + outSize);
      
            return -1; //see if a different TIP might work better. 
          }
      

      The resource calculation is at

      // in ResourceEstimator.java
      protected synchronized long getEstimatedTotalMapOutputSize()  {
          if(completedMapsUpdates < threshholdToUse) {
            return 0;
          } else {
            long inputSize = job.getInputLength() + job.desiredMaps(); 
            //add desiredMaps() so that randomwriter case doesn't blow up
            //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);
            }
            return estimate;
          }
        }
      protected synchronized void updateWithCompletedTask(TaskStatus ts, 
            TaskInProgress tip) {
      
          //-1 indicates error, which we don't average in.
          if(tip.isMapTask() &&  ts.getOutputSize() != -1)  {
            completedMapsUpdates++;
      
            completedMapsInputSize+=(tip.getMapInputSize()+1);
            completedMapsOutputSize+=ts.getOutputSize();
      
            if(LOG.isDebugEnabled()) {
              LOG.debug("completedMapsUpdates:"+completedMapsUpdates+"  "+
                        "completedMapsInputSize:"+completedMapsInputSize+"  " +
                        "completedMapsOutputSize:"+completedMapsOutputSize);
            }
          }
        }
      

      You can see in the calculation:
      completedMapsInputSize will be a very small number and inputSize *
      completedMapsOutputSize will be a very big number
      For example, completedMapsInputSize = 1; inputSize = 100MBytes and completedMapsOutputSize=100MBytes,
      The estimate will be 5000TB which will be more than most task tracker disk space size.

      So I think if the map split input length is 0, it means the split input length is unknown and it is reasonable to use map output size as input size for the calculation in ResourceEstimator. I will upload a fix based on this method.

      Attachments

        Activity

          People

            zxu Zhihai Xu
            zxu Zhihai Xu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: