Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-6907

KeyValue equals and compareTo methods should match

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.95.0
    • util
    • None
    • Reviewed
    • Hide
      KeyValue.equals() method used to ignore the memstoreTS.
      Now KeyValue.equals() takes memstoreTS into account and is aligned with KeyValue.KVComparator in behavior
      Show
      KeyValue.equals() method used to ignore the memstoreTS. Now KeyValue.equals() takes memstoreTS into account and is aligned with KeyValue.KVComparator in behavior

    Description

      KeyValue.KVComparator includes the memstoreTS when comparing, however the KeyValue.equals() method ignores the memstoreTS.

      The Comparator interface has always specified that comparator return 0 when equals would return true and vice versa. Obeying that rule has been sort of optional in the past, but Java 7 introduces a new default collection sorting algorithm called Tim Sort which relies on that behavior. http://bugs.sun.com/view_bug.do?bug_id=6804124

      Possible problem spots:

      • there's a Collections.sort(KeyValues) in RedundantKVGenerator.generateTestKeyValues(..)
      • TestColumnSeeking compares two collections of KeyValues using the containsAll method. It is intentionally ignoring memstoreTS, so will need an alternative method for comparing the two collections.

      Attachments

        1. 6907-v5.txt
          8 kB
          Ted Yu
        2. 6907-v4.txt
          8 kB
          Ted Yu
        3. 6907-v3.txt
          7 kB
          Ted Yu
        4. 6907-v2.txt
          6 kB
          Ted Yu
        5. 6907-v1.txt
          4 kB
          Ted Yu

        Issue Links

          Activity

            People

              yuzhihong@gmail.com Ted Yu
              mcorgan Matt Corgan
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: