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

FuzzyRow filter getNextForFuzzyRule not working properly for special case

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Abandoned
    • 0.94.11
    • None
    • Filters
    • None
    • Issue is not dependent upon environment.

    Description

      The case that getNextForFuzzyRule() fails is when the result (fuzzy key) is extended in length (zero padded) to match the current row for comparisons. If the hint is returned with zero padded bytes, the next seek may skip over a valid match. See the example below.

      /**

      • The code below circumvents the following situation.
      • fuzzy.key = visitor,session,Logon
      • fuzzy.mask = 000000001111111000000
      • example hbase row data:
      • visitor,session,AddToCart
      • " " FacebookLike
      • " " Logon
      • " " MobileSpecial
      • ...
      • For row "visitor,sessionAddToCart", the current code would
      • return a hint of "visitor,session,Logon\0\0\0\0" (zero padded).
      • The next seek would skip "visitor,session,Logon" and jump
      • to "visitor,session,MobileSpecial".
        */

      // trim trailing zeros that were not part of the original fuzzy key
      int i = result.length;
      for (; i > fuzzyKeyBytes.length; i--)

      { if (result[i-1] != 0x00) break; }

      if (i != result.length)

      { result = Arrays.copyOf(result, i); }

      The code above added to the end of getNextFuzzyRule() will circumvent the issue. I tested my scenario and it produces the correct results. There may be a better solution.

      Thanks.

      Attachments

        1. TestFuzzyRowFilter.patch
          0.8 kB
          Tony Dean

        Activity

          People

            Unassigned Unassigned
            saspad Tony Dean
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: