You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Geoff Hendrey <gh...@decarta.com> on 2011/09/13 22:20:50 UTC

how to get encoded region ID

Hi -

 

I am writing a tool (which I will share) to remove regions, and move
their data off to the side in an HDFS backup area. We need this tool
because we have a lot of regions which are garbage, and we just want to
get rid of them en mass. 

 

However, I need to determine the string value of the region ID, so that
I can go into HDFS and move the actual region directory. I cannot tell,
from the HRegionInfo class, how to get the ID as a String.

 

Maybe it's 

 

   byte[][] parseRegionName =
HRegionInfo.parseRegionName(closedRegion.getEncodedNameAsBytes());

        byte[] regionId = parseRegionName[parseRegionName.length-1];

       String id = Bytes.toString(regionId);

 

anyone? Can't find any docs on the structure of the 2-dimensional byte
array returned by parseRegionName.

 

-geoff


Re: how to get encoded region ID

Posted by Stack <st...@duboce.net>.
See https://issues.apache.org/jira/browse/HBASE-3887

The name of the directory in hdfs is the encoded name of the region.
The encoded name is part of full region name. Its the sha-1 sequence
on the end of the region name.

St.Ack

On Tue, Sep 13, 2011 at 1:20 PM, Geoff Hendrey <gh...@decarta.com> wrote:
> Hi -
>
>
>
> I am writing a tool (which I will share) to remove regions, and move
> their data off to the side in an HDFS backup area. We need this tool
> because we have a lot of regions which are garbage, and we just want to
> get rid of them en mass.
>
>
>
> However, I need to determine the string value of the region ID, so that
> I can go into HDFS and move the actual region directory. I cannot tell,
> from the HRegionInfo class, how to get the ID as a String.
>
>
>
> Maybe it's
>
>
>
>   byte[][] parseRegionName =
> HRegionInfo.parseRegionName(closedRegion.getEncodedNameAsBytes());
>
>        byte[] regionId = parseRegionName[parseRegionName.length-1];
>
>       String id = Bytes.toString(regionId);
>
>
>
> anyone? Can't find any docs on the structure of the 2-dimensional byte
> array returned by parseRegionName.
>
>
>
> -geoff
>
>