Issue Details (XML | Word | Printable)

Key: HADOOP-3863
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Arun C Murthy
Reporter: Arun C Murthy
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

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

Created: 30/Jul/08 05:59 PM   Updated: 08/Jul/09 04:52 PM
Return to search
Component/s: None
Affects Version/s: 0.18.0
Fix Version/s: 0.19.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works HADOOP-3863_0_20080730.patch 2008-07-30 06:53 PM Arun C Murthy 5 kB
Text File Licensed for inclusion in ASF works HADOOP-3863_1_20080730.patch 2008-07-30 09:57 PM Arun C Murthy 5 kB

Hadoop Flags: Reviewed
Resolution Date: 30/Jul/08 10:59 PM


 Description  « Hide
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.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Arun C Murthy added a comment - 30/Jul/08 06:53 PM
Fixed Text to use ThreadLocal encoders/decoders.

Hadoop QA added a comment - 30/Jul/08 08:56 PM
-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.


Owen O'Malley added a comment - 30/Jul/08 09:27 PM
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.

Arun C Murthy added a comment - 30/Jul/08 09:57 PM
Renamed the variable, same patch.

Arun C Murthy added a comment - 30/Jul/08 09:58 PM
The test failure (org.apache.hadoop.hdfs.TestFileAppend2.testComplexAppend) is unrelated.

Doug Cutting added a comment - 30/Jul/08 10:06 PM
I filed HADOOP-3874 to address this. (We should file bugs whenever unrelated tests fail, no?)

Tsz Wo (Nicholas), SZE added a comment - 30/Jul/08 10:57 PM
> 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?


Owen O'Malley added a comment - 30/Jul/08 10:59 PM
I just committed this. Thanks, Arun!

Tsz Wo (Nicholas), SZE added a comment - 30/Jul/08 11:07 PM
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.

Arun C Murthy added a comment - 30/Jul/08 11:13 PM
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.


Tsz Wo (Nicholas), SZE added a comment - 30/Jul/08 11:25 PM
> 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.


Hudson added a comment - 22/Aug/08 12:34 PM