hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jiraposter@reviews.apache.org (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-5489) Add HTable accessor to get regions for a key range
Date Thu, 01 Mar 2012 06:06:22 GMT

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

jiraposter@reviews.apache.org commented on HBASE-5489:
------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4117/
-----------------------------------------------------------

(Updated 2012-03-01 06:05:46.664490)


Review request for hbase.


Changes
-------

Made endKey exclusive.  Also added a few more unit tests and fixed a logic error for the termination
of the main loop in a couple of corner cases regarding when the specified end key to getRegionsInRange()
is EMPTY_END_ROW, and/or when the last region in the range's end key is EMPTY_END_ROW.


Summary
-------

getRegionsInRange() will retrieve the HRegionLocations for the regions associated with the
specified key range, using client-side cache if possible.

I have one question: right now the endKey specified to getRegionsInRange() is treated as inclusive.
 I followed the behavior that I saw in HRegionInfo.containsRange().  However, other HBase
code such as Scan treats the endKey as exclusive.  So I am not clear as to which way we should
go here.  I can easily change the patch if we want the endKey to be exclusive; please let
me know.  Thanks in advance.


This addresses bug HBASE-5489.
    https://issues.apache.org/jira/browse/HBASE-5489


Diffs (updated)
-----

  src/main/java/org/apache/hadoop/hbase/client/HTable.java 29b8004 
  src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java bdeaefe 

Diff: https://reviews.apache.org/r/4117/diff


Testing
-------

Ran the TestFromClientSide unit tests and passed repeatedly.

Ran test-patch.sh with the following results:

-1 overall.  

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    -1 javadoc.  The javadoc tool appears to have generated -129 warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version ) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit
warnings.


Thanks,

David


                
> Add HTable accessor to get regions for a key range
> --------------------------------------------------
>
>                 Key: HBASE-5489
>                 URL: https://issues.apache.org/jira/browse/HBASE-5489
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>            Reporter: David S. Wang
>            Assignee: David S. Wang
>            Priority: Minor
>             Fix For: 0.92.1, 0.94.0, 0.96.0
>
>
> It would be nice to have an accessor to find all regions that overlap with a particular
range of keys. Right now, the only way to accomplish that is to call HTable.getStartEndKeys(),
then follow that with calls to getRegionLocation() for the range of keys you are interested
in.  This algorithm has 2 drawbacks:
> * It returns more keys than is necessary most of the time.  This is especially evident
if there are a lot of regions comprising the table and the range of keys is small.
> * It always does a scan of .META. via MetaScannerVisitor for at least HTable.getStartEndKeys(),
and perhaps for HRegionLocations that are not already cached by the client.
> An accessor that limited its scans to a specified range could avoid scanning .META. at
all if the HRegionLocations being fetched were already cached by the client, thereby potentially
making this operation faster in common cases.
> Here's a proposal for the accessor:
>   /**
>    * Get the corresponding regions for an arbitrary range of keys.
>    * <p>
>    * @param startRow Starting row in range, inclusive
>    * @param endRow Ending row in range, inclusive
>    * @return A list of HRegionLocations corresponding to the regions that
>    * contain the specified range
>    * @throws IOException if a remote or network exception occurs
>    */
>   public List<HRegionLocation> getRegionsInRange(final byte [] startKey,
>     final byte [] endKey) throws IOException

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message