Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-4797

BlockScanInfo does not override equals(..) and hashCode() consistently

    XMLWordPrintableJSON

    Details

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

      Description

      In the code below, equals(..) compares lastScanTime but hashCode() is computed using block ID. Therefore, it could have two BlockScanInfo objects which are equal but have two different hash codes.

      //BlockScanInfo
          @Override
          public int hashCode() {
            return block.hashCode();
          }
          
          @Override
          public boolean equals(Object other) {
            return other instanceof BlockScanInfo &&
                   compareTo((BlockScanInfo)other) == 0;
          }
      

        Attachments

        1. h4797_20130513.patch
          2 kB
          Tsz-wo Sze
        2. h4797_20130513b.patch
          3 kB
          Tsz-wo Sze

          Issue Links

            Activity

              People

              • Assignee:
                szetszwo Tsz-wo Sze
                Reporter:
                szetszwo Tsz-wo Sze
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: