You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Anoop Sam John (JIRA)" <ji...@apache.org> on 2013/03/01 04:43:13 UTC

[jira] [Commented] (HBASE-7928) Scanning .META. with startRow and/or stopRow is not giving proper results

    [ https://issues.apache.org/jira/browse/HBASE-7928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13590211#comment-13590211 ] 

Anoop Sam John commented on HBASE-7928:
---------------------------------------

Ram
 We can have HConstants.META_ROW_DELIMITER_STR constant as byte[] rather than String?
You can avoid Bytes.toBytes() in
{code}
return (com.google.common.primitives.Bytes.indexOf(metaRow,
+        Bytes.toBytes(HConstants.META_ROW_DELIMITER_STR)) != -1);
{code}
Also 
{code}
Bytes.add(
+          scan.getStartRow(),
+          Bytes.toBytes(HConstants.META_ROW_DELIMITER_STR + HConstants.META_ROW_DELIMITER_STR
+              + HConstants.ZEROES)
{code}
can be like
{code}
Bytes.add(scan.getStartRow(),HConstants.META_ROW_DELIMITER_BYTES,Bytes.toBytes(HConstants.ZEROES))
{code}
HConstants.META_ROW_DELIMITER_BYTES  can be byte[] from ",," rather than from ","?

What do you say Ram?

I will open another issue and will add the indexOf() API into HBase util Bytes class (May be some other useful items also there? I will see). IMO that util may help other users. Any way that is out of scope of this issue.
                
> Scanning .META. with startRow and/or stopRow is not giving proper results
> -------------------------------------------------------------------------
>
>                 Key: HBASE-7928
>                 URL: https://issues.apache.org/jira/browse/HBASE-7928
>             Project: HBase
>          Issue Type: Bug
>          Components: Usability
>    Affects Versions: 0.94.5
>            Reporter: Jean-Marc Spaggiari
>            Assignee: ramkrishna.s.vasudevan
>         Attachments: HBASE-7928_0.94_1.patch, HBASE-7928_0.94_2.patch, HBASE-7928_0.94_3.patch, HBASE-7928_0.94.patch, HBASE-7928_trunk_1.patch, HBASE-7928_trunk_2.patch, HBASE-7928_trunk.patch
>
>
> {code}
>     try {
>       HTable metaTable = new HTable(config, Bytes.toBytes(".META."));
>       Scan scan = new Scan();
>       scan.setStartRow(Bytes.toBytes("e"));
>       scan.setStopRow(Bytes.toBytes("z"));
>       ResultScanner scanner = metaTable.getScanner(scan);
>       Result[] results = scanner.next(100);
>       while (results.length > 0) {
>         for (Result result : results) {
>           System.out.println(Bytes.toString(result.getRow()));
>         }
>         results = scanner.next(100);
>       }
>       scanner.close();
>       metaTable.close();
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
> {code}
> This code will not return any result even if there is 10 tables with names starting with "d" to "w", including one table called "entry". If you comment the setStopRow you will get results, but will still get rows starting with "d" even if setStartRow is set to "e".
> Same code using with a user table is working fine.
> Facing the same issue with the shell.
> scan '.META.' , {STARTROW => 'e', LIMIT => 10} is returning rows starting by "d".
> scan '.META.' , {STARTROW => 'e', STOPROW => 'v', LIMIT => 10} is not returning anything.

--
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