Hadoop Common
  1. Hadoop Common
  2. HADOOP-7151

Document need for stable hashCode() in WritableComparable

    Details

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

      Description

      When a Writable is used as a key, HashPartitioner implicitly assumes that hashCode() will return the same value across different instances of the JVM. This is not a guaranteed behavior in Java, and Object's default hashCode() does not in fact do this, which can lead to subtle bugs. This requirement should be explicitly called out.

      In addition the sample MyWritable in the javadoc for WritableComparable does not implement hashCode() and thus has a bug. That should be fixed.

      1. HADOOP-7151.patch
        1 kB
        Dmitriy V. Ryaboy
      2. HADOOP-7151.patch
        2 kB
        Dmitriy V. Ryaboy

        Activity

        Hide
        Hudson added a comment -

        Integrated in Hadoop-Common-trunk #616 (See https://hudson.apache.org/hudson/job/Hadoop-Common-trunk/616/)
        HADOOP-7151. Document need for stable hashCode() in WritableComparable. Contributed by Dmitriy V. Ryaboy.

        Show
        Hudson added a comment - Integrated in Hadoop-Common-trunk #616 (See https://hudson.apache.org/hudson/job/Hadoop-Common-trunk/616/ ) HADOOP-7151 . Document need for stable hashCode() in WritableComparable. Contributed by Dmitriy V. Ryaboy.
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Common-trunk-Commit #511 (See https://hudson.apache.org/hudson/job/Hadoop-Common-trunk-Commit/511/)
        HADOOP-7151. Document need for stable hashCode() in WritableComparable. Contributed by Dmitriy V. Ryaboy.

        Show
        Hudson added a comment - Integrated in Hadoop-Common-trunk-Commit #511 (See https://hudson.apache.org/hudson/job/Hadoop-Common-trunk-Commit/511/ ) HADOOP-7151 . Document need for stable hashCode() in WritableComparable. Contributed by Dmitriy V. Ryaboy.
        Hide
        Todd Lipcon added a comment -

        Committed to trunk, thanks Dmitriy!

        Show
        Todd Lipcon added a comment - Committed to trunk, thanks Dmitriy!
        Hide
        Todd Lipcon added a comment -

        +1

        Show
        Todd Lipcon added a comment - +1
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12471806/HADOOP-7151.patch
        against trunk revision 1074005.

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

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +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 (version 1.3.9) warnings.

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

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

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

        +1 system test framework. The patch passed system test framework compile.

        Test results: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/296//testReport/
        Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/296//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/296//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/12471806/HADOOP-7151.patch against trunk revision 1074005. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +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 (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. +1 system test framework. The patch passed system test framework compile. Test results: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/296//testReport/ Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/296//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/296//console This message is automatically generated.
        Hide
        Dmitriy V. Ryaboy added a comment -

        let's try that again..

        Show
        Dmitriy V. Ryaboy added a comment - let's try that again..
        Hide
        Todd Lipcon added a comment -

        Can you regen the patch against trunk?

        Show
        Todd Lipcon added a comment - Can you regen the patch against trunk?
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12471457/HADOOP-7151.patch
        against trunk revision 1071364.

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

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        -1 patch. The patch command could not apply the patch.

        Console output: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/293//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/12471457/HADOOP-7151.patch against trunk revision 1071364. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. -1 patch. The patch command could not apply the patch. Console output: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/293//console This message is automatically generated.
        Hide
        Dmitriy V. Ryaboy added a comment -

        Attached is a javadoc-only patch.

        Show
        Dmitriy V. Ryaboy added a comment - Attached is a javadoc-only patch.

          People

          • Assignee:
            Dmitriy V. Ryaboy
            Reporter:
            Dmitriy V. Ryaboy
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development