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

KeyComparator.compareWithoutRow can be wrong when families have the same prefix

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 0.90.6, 0.92.1, 0.94.0
    • 0.92.2, 0.94.1, 0.95.0
    • None
    • None
    • Reviewed

    Description

      As reported by Desert Rose on IRC and on the ML, Result has a weird behavior when some families share the same prefix. He posted a link to his code to show how it fails, http://pastebin.com/7TBA1XGh

      Basically KeyComparator.compareWithoutRow doesn't differentiate families and qualifiers so "f:a" is said to be bigger than "f1:", which is false. Then what happens is that the KVs are returned in the right order from the RS but then doing Result.binarySearch it uses KeyComparator.compareWithoutRow which has a different sorting so the end result is undetermined.

      I added some debug and I can see that the data is returned in the right order but Arrays.binarySearch returned the wrong KV, which is then verified agains the passed family and qualifier which fails so null is returned.

      I don't know how frequent it is for users to have families with the same prefix, but those that do have that and that use those families at the same time will have big correctness issues. This is why I mark this as a blocker.

      Attachments

        1. 6200-0.92.txt
          9 kB
          Ted Yu
        2. 6200-0.94.txt
          8 kB
          Ted Yu
        3. 6200-90.patch
          9 kB
          Jieshan Bean
        4. 6200-trunk-v2.patch
          9 kB
          Ted Yu
        5. 6200-trunk-v3.patch
          9 kB
          Jieshan Bean
        6. 6200-trunk-v4.txt
          9 kB
          Ted Yu

        Issue Links

          Activity

            People

              jeason Jieshan Bean
              jdcryans Jean-Daniel Cryans
              Votes:
              0 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: