You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Tony Dean (JIRA)" <ji...@apache.org> on 2013/08/25 06:20:52 UTC

[jira] [Updated] (HBASE-9331) FuzzyRow filter getNextForFuzzyRule not working properly for special case

     [ https://issues.apache.org/jira/browse/HBASE-9331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Dean updated HBASE-9331:
-----------------------------

    Attachment: TestFuzzyRowFilter.patch
    
> FuzzyRow filter getNextForFuzzyRule not working properly for special case
> -------------------------------------------------------------------------
>
>                 Key: HBASE-9331
>                 URL: https://issues.apache.org/jira/browse/HBASE-9331
>             Project: HBase
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 0.94.11
>         Environment: Issue is not dependent upon environment.
>            Reporter: Tony Dean
>         Attachments: TestFuzzyRowFilter.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira