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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.1.0-beta
    • datanode
    • None
    • 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_20130513b.patch
          3 kB
          Tsz-wo Sze
        2. h4797_20130513.patch
          2 kB
          Tsz-wo Sze

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: