Hadoop Common
  1. Hadoop Common
  2. HADOOP-3863

Use a thread-local rather than static ENCODER/DECODER variables in Text for synchronization

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 0.18.0
    • Fix Version/s: 0.19.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Text.

      {ENCODER|DECODER}

      are static variables which need to be synchronized in Text.

      {read|write}String; given that lots of RPC code calls Text.{read|write}

      String the contention for this lock shows up very significantly on large clusters.

      1. HADOOP-3863_1_20080730.patch
        5 kB
        Arun C Murthy
      2. HADOOP-3863_0_20080730.patch
        5 kB
        Arun C Murthy

        Activity

        Hide
        Arun C Murthy added a comment -

        Fixed Text to use ThreadLocal encoders/decoders.

        Show
        Arun C Murthy added a comment - Fixed Text to use ThreadLocal encoders/decoders.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12387218/HADOOP-3863_0_20080730.patch
        against trunk revision 680823.

        +1 @author. The patch does not contain any @author tags.

        +1 tests included. The patch appears to include 3 new or modified tests.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        -1 core tests. The patch failed core unit tests.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/artifact/trunk/build/test/checkstyle-errors.html
        Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12387218/HADOOP-3863_0_20080730.patch against trunk revision 680823. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 3 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/artifact/trunk/build/test/checkstyle-errors.html Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2985/console This message is automatically generated.
        Hide
        Owen O'Malley added a comment -

        This looks good, but I'd suggest renaming to be

        {DE,EN}

        CODER_FACTORY to make it clear that each thread will get a different one.

        Show
        Owen O'Malley added a comment - This looks good, but I'd suggest renaming to be {DE,EN} CODER_FACTORY to make it clear that each thread will get a different one.
        Hide
        Arun C Murthy added a comment -

        Renamed the variable, same patch.

        Show
        Arun C Murthy added a comment - Renamed the variable, same patch.
        Hide
        Arun C Murthy added a comment -

        The test failure (org.apache.hadoop.hdfs.TestFileAppend2.testComplexAppend) is unrelated.

        Show
        Arun C Murthy added a comment - The test failure (org.apache.hadoop.hdfs.TestFileAppend2.testComplexAppend) is unrelated.
        Hide
        Doug Cutting added a comment -

        I filed HADOOP-3874 to address this. (We should file bugs whenever unrelated tests fail, no?)

        Show
        Doug Cutting added a comment - I filed HADOOP-3874 to address this. (We should file bugs whenever unrelated tests fail, no?)
        Hide
        Tsz Wo Nicholas Sze added a comment -

        > The test failure (org.apache.hadoop.hdfs.TestFileAppend2.testComplexAppend) is unrelated.

        I am not sure whether it is unrelated since this patch changes a core class and this is the first time that TestFileAppend2.testComplexAppend fails. TestFileAppend2.testComplexAppend create a number of threads appending files concurrently. It seems to me that it might be related. Could we try Hudson one more time?

        Show
        Tsz Wo Nicholas Sze added a comment - > The test failure (org.apache.hadoop.hdfs.TestFileAppend2.testComplexAppend) is unrelated. I am not sure whether it is unrelated since this patch changes a core class and this is the first time that TestFileAppend2.testComplexAppend fails. TestFileAppend2.testComplexAppend create a number of threads appending files concurrently. It seems to me that it might be related. Could we try Hudson one more time?
        Hide
        Owen O'Malley added a comment -

        I just committed this. Thanks, Arun!

        Show
        Owen O'Malley added a comment - I just committed this. Thanks, Arun!
        Hide
        Tsz Wo Nicholas Sze added a comment -

        According to CharsetDecoder javadoc http://java.sun.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html, there is a specific sequence of decoding operations. In particular, we should call reset() before using the decoder. It seems we are not following it.

        Show
        Tsz Wo Nicholas Sze added a comment - According to CharsetDecoder javadoc http://java.sun.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html , there is a specific sequence of decoding operations . In particular, we should call reset() before using the decoder. It seems we are not following it.
        Hide
        Arun C Murthy added a comment -

        Fair point, Doug - taken; although it seems TestFileAppend2 works consistently on my machine.

        Nicholas - we are are using http://java.sun.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer) which does the whole 'decoding' operation, ditto for encoding.

        Show
        Arun C Murthy added a comment - Fair point, Doug - taken; although it seems TestFileAppend2 works consistently on my machine. Nicholas - we are are using http://java.sun.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer ) which does the whole 'decoding' operation, ditto for encoding.
        Hide
        Tsz Wo Nicholas Sze added a comment -

        > Nicholas - we are are using http://java.sun.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer) which does the whole 'decoding' operation, ditto for encoding.

        Thanks Arun, I missed this.

        BTW, TestFileAppend2 also works consistently in my Windows and Linux machines.

        Show
        Tsz Wo Nicholas Sze added a comment - > Nicholas - we are are using http://java.sun.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer ) which does the whole 'decoding' operation, ditto for encoding. Thanks Arun, I missed this. BTW, TestFileAppend2 also works consistently in my Windows and Linux machines.
        Hide
        Hudson added a comment -
        Show
        Hudson added a comment - Integrated in Hadoop-trunk #581 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/581/ )

          People

          • Assignee:
            Arun C Murthy
            Reporter:
            Arun C Murthy
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development