hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lyska Anton <ant...@wildec.com>
Subject Re: HConnection.locateRegions returns null
Date Thu, 03 Jan 2013 09:33:43 GMT
Hi,

thanks a lot!
as Nicolas wrote, I use

         List<HRegionInfo> regions = MetaScanner.listAllRegions(config);
         for (HRegionInfo info : regions) {
             HRegionLocation loc = connection.locateRegion(info.getTableName(), info.getStartKey());
             ....
         }

03.01.2013 2:34, Jean-Marc Spaggiari пишет:
> Here is the code for locateRegion:
>
>      @Override
>      public List<HRegionLocation> locateRegions(final byte [] tableName)
>      throws IOException {
>        // TODO implement.  use old stuff or new stuff?
>        return null;
>      }
>
>
> As you can see, it's like what Nicolas is saying. Always return null.
>
> However, relocateRegion is calling a private locateRegions which is
> not returning null.... You might want to try that?
>
> Also, I played few weeks ago with the  region balancing. You can take
> a look here to see what I did.
> http://www.spaggiari.org/index.php/hbase/changing-the-hbase-default-loadbalancer
> You can do yours based on that.
>
> Nicolas, should we not have locateRegion "simply" calling the private
> locateRegion method?
>
> JM
>
> 2013/1/2, Nicolas Liochon <nkeywal@gmail.com>:
>> Hi,
>>
>> It's actually not implemented (I will update the javadoc for the latest
>> version)
>> You can use locateRegion(final byte [] tableName, final byte [] row), and
>> iterates on all region start keys to get all the regions.
>>
>> Cheers,
>>
>> Nicolas
>>
>>
>>
>>
>> On Wed, Jan 2, 2013 at 5:17 PM, Lyska Anton <antony@wildec.com> wrote:
>>
>>> Hi all,
>>>
>>> I want to write simple tool for rebalancing regions in cluster.
>>> For that I need current location of all regions.
>>> I've found method HConnection.locateRegions(**tableName), but it always
>>> returns null.
>>> Also, i've tried to call HConnection.locateRegion(**regionName), and it
>>> returns null too.
>>>
>>> sample code:
>>>
>>>          Configuration config = HBaseConfiguration.create();
>>>          config.set("hbase.zookeeper.**quorum", host);
>>>
>>>          HConnection connection = HConnectionManager.**
>>> createConnection(config);
>>>          List<HRegionLocation> locations =
>>> connection.locateRegions(**tableName);
>>>   //return null here
>>>
>>> HBase Version    0.92.1-cdh4.1.2
>>>
>>> Thanks in advance.
>>>
>>>


Mime
View raw message