You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-dev@hadoop.apache.org by "zhihai xu (JIRA)" <ji...@apache.org> on 2014/09/02 11:56:21 UTC

[jira] [Created] (MAPREDUCE-6063) In sortAndSpill of MapTask.java, size is calculated wrongly when bufend < bufstart.

zhihai xu created MAPREDUCE-6063:
------------------------------------

             Summary: In sortAndSpill of MapTask.java, size is calculated wrongly when bufend < bufstart.
                 Key: MAPREDUCE-6063
                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6063
             Project: Hadoop Map/Reduce
          Issue Type: Bug
          Components: mrv1, mrv2
            Reporter: zhihai xu
            Assignee: zhihai xu


In sortAndSpill of MapTask.java, size is calculated wrongly when bufend < bufstart.  we should change (bufvoid - bufend) + bufstart to (bufvoid - bufstart) + bufend.
Should change
{code}
     long size = (bufend >= bufstart
          ? bufend - bufstart
          : (bufvoid - bufend) + bufstart) +
                  partitions * APPROX_HEADER_LENGTH;
{code}
to:
{code}
     long size = (bufend >= bufstart
          ? bufend - bufstart
          : (bufvoid - bufstart) + bufend) +
                  partitions * APPROX_HEADER_LENGTH;
{code}

It is because when wraparound happen (bufend < bufstart) ,  the size should 
bufvoid - bufstart (bigger one) + bufend(small one).
You can find similar code implementation in MapTask.java:
{code}
        mapOutputByteCounter.increment(valend >= keystart
            ? valend - keystart
            : (bufvoid - keystart) + valend);
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)