Hadoop Common
  1. Hadoop Common
  2. HADOOP-161

dfs blocks define equal, but not hashcode

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.1.1
    • Fix Version/s: 0.3.0
    • Component/s: None
    • Labels:
      None

      Description

      Findbugs reports that dfs.Block defines equals but not hashcode, which is problematic if it is ever put into a hash table.

      1. hadoop-161-correct.patch
        0.4 kB
        Milind Bhandarkar
      2. hadoop-161.patch
        0.5 kB
        Milind Bhandarkar

        Activity

        Hide
        Doug Cutting added a comment -

        I just committed this. Thanks, Milind!

        Show
        Doug Cutting added a comment - I just committed this. Thanks, Milind!
        Hide
        Milind Bhandarkar added a comment -

        Please disregard the last patch. Since equals compares blockIds only, hashCode should also consider only blockIds. Correct patch is attached here.

        Show
        Milind Bhandarkar added a comment - Please disregard the last patch. Since equals compares blockIds only, hashCode should also consider only blockIds. Correct patch is attached here.
        Hide
        Milind Bhandarkar added a comment -

        Added a hashCode method to Block. The hash algorithm is from "Effective Java" by Joshua Bloch.

        Show
        Milind Bhandarkar added a comment - Added a hashCode method to Block. The hash algorithm is from "Effective Java" by Joshua Bloch.

          People

          • Assignee:
            Milind Bhandarkar
            Reporter:
            Owen O'Malley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development