You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by "Marcelo Valle (BLOOMBERG/ LONDON)" <mv...@bloomberg.net> on 2015/02/25 16:09:07 UTC

table splitting - how to check

Hi,

I have created an HBase table just like that:

t = create 'HBaseSerialWritesPOC', 'user_id_ts', {NAME => 'alnfo'},  {SPLITS => ['100000000000000000000000', '200000000000000000000000', '300000000000000000000000', '400000000000000000000000', '500000000000000000000000', '600000000000000000000000', '700000000000000000000000', '800000000000000000000000', '900000000000000000000000', 'a00000000000000000000000', 'b00000000000000000000000', 'c00000000000000000000000', 'd00000000000000000000000', 'e00000000000000000000000', 'f00000000000000000000000']}

After some tests, I truncated the table.

Then I inserted 1 million rows, just to test. I was expecting to have 16 regions for this table, but when I checked admin UI, I saw two regions:

Table Regions
Name       Region Server   Start Key       End Key Requests
HBaseSerialWritesPOC,,1424873821297.cf92656f68a16e9696d0fbfe2494219b.        host1           800000190000125396f3f2bb        500625
HBaseSerialWritesPOC,800000190000125396f3f2bb,1424873821297.696a25e590e3248005c638c0f86c0564.  host2   800000190000125396f3f2bb                500621

I am new to HBase, so it really means just 2 regions have been created, right? It seems keys have been split in a half, 0000.. To ffff... 

I disabled, dropped and created the table again using the same command bellow, then I saw 16 regions, as expected.

Question 1: Is it possible to check the same thing using hbase shell?

Question 2: Is it expected behavior the truncate messing up the splits? What kind of DML operations could change the splits in my table? I am using HBase 0.96.1.2.0.10.0-1-hadoop2

-Marcelo

Re: table splitting - how to check

Posted by Ted Yu <yu...@gmail.com>.
truncate_preserve.rb was added by HBASE-5525 which went into 0.95.
So it should be in 0.96

Cheers

On Wed, Feb 25, 2015 at 7:14 AM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:

> Hi Marcelo,
>
> Truncate also removes the regions boundaries. You can use truncate_preserve
> if you want to keep your region splits. Not sure if it's available in
> 0.96...
>
> Also, I don't think you can look at the splits from the shell command...
>
> JM
>
> 2015-02-25 10:09 GMT-05:00 Marcelo Valle (BLOOMBERG/ LONDON) <
> mvallemilita@bloomberg.net>:
>
> > Hi,
> >
> > I have created an HBase table just like that:
> >
> > t = create 'HBaseSerialWritesPOC', 'user_id_ts', {NAME => 'alnfo'},
> > {SPLITS => ['100000000000000000000000', '200000000000000000000000',
> > '300000000000000000000000', '400000000000000000000000',
> > '500000000000000000000000', '600000000000000000000000',
> > '700000000000000000000000', '800000000000000000000000',
> > '900000000000000000000000', 'a00000000000000000000000',
> > 'b00000000000000000000000', 'c00000000000000000000000',
> > 'd00000000000000000000000', 'e00000000000000000000000',
> > 'f00000000000000000000000']}
> >
> > After some tests, I truncated the table.
> >
> > Then I inserted 1 million rows, just to test. I was expecting to have 16
> > regions for this table, but when I checked admin UI, I saw two regions:
> >
> > Table Regions
> > Name       Region Server   Start Key       End Key Requests
> > HBaseSerialWritesPOC,,1424873821297.cf92656f68a16e9696d0fbfe2494219b.
> >   host1           800000190000125396f3f2bb        500625
> >
> HBaseSerialWritesPOC,800000190000125396f3f2bb,1424873821297.696a25e590e3248005c638c0f86c0564.
> > host2   800000190000125396f3f2bb                500621
> >
> > I am new to HBase, so it really means just 2 regions have been created,
> > right? It seems keys have been split in a half, 0000.. To ffff...
> >
> > I disabled, dropped and created the table again using the same command
> > bellow, then I saw 16 regions, as expected.
> >
> > Question 1: Is it possible to check the same thing using hbase shell?
> >
> > Question 2: Is it expected behavior the truncate messing up the splits?
> > What kind of DML operations could change the splits in my table? I am
> using
> > HBase 0.96.1.2.0.10.0-1-hadoop2
> >
> > -Marcelo
>

Re: table splitting - how to check

Posted by Sean Busbey <bu...@cloudera.com>.
You can get the list of splits from the shell, but only by peeking behind
the curtain of the API.

jruby-1.7.3 :012 > create 'example_table', 'f1', SPLITS => ["10", "20",
"30", "40"]
0 row(s) in 0.5500 seconds

 => Hbase::Table - example_table
jruby-1.7.3 :013 >
get_table('example_table').table.get_all_region_locations.map do |location|
org.apache.hadoop.hbase.util.Bytes::toStringBinary(location.get_region_info.get_start_key)
end
0 row(s) in 0.0130 seconds

 => ["", "10", "20", "30", "40"]
jruby-1.7.3 :014 >

I filed HBASE-13100 to get a stable solution.

On Wed, Feb 25, 2015 at 9:14 AM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:

> Hi Marcelo,
>
> Truncate also removes the regions boundaries. You can use truncate_preserve
> if you want to keep your region splits. Not sure if it's available in
> 0.96...
>
> Also, I don't think you can look at the splits from the shell command...
>
> JM
>
> 2015-02-25 10:09 GMT-05:00 Marcelo Valle (BLOOMBERG/ LONDON) <
> mvallemilita@bloomberg.net>:
>
> > Hi,
> >
> > I have created an HBase table just like that:
> >
> > t = create 'HBaseSerialWritesPOC', 'user_id_ts', {NAME => 'alnfo'},
> > {SPLITS => ['100000000000000000000000', '200000000000000000000000',
> > '300000000000000000000000', '400000000000000000000000',
> > '500000000000000000000000', '600000000000000000000000',
> > '700000000000000000000000', '800000000000000000000000',
> > '900000000000000000000000', 'a00000000000000000000000',
> > 'b00000000000000000000000', 'c00000000000000000000000',
> > 'd00000000000000000000000', 'e00000000000000000000000',
> > 'f00000000000000000000000']}
> >
> > After some tests, I truncated the table.
> >
> > Then I inserted 1 million rows, just to test. I was expecting to have 16
> > regions for this table, but when I checked admin UI, I saw two regions:
> >
> > Table Regions
> > Name       Region Server   Start Key       End Key Requests
> > HBaseSerialWritesPOC,,1424873821297.cf92656f68a16e9696d0fbfe2494219b.
> >   host1           800000190000125396f3f2bb        500625
> >
> HBaseSerialWritesPOC,800000190000125396f3f2bb,1424873821297.696a25e590e3248005c638c0f86c0564.
> > host2   800000190000125396f3f2bb                500621
> >
> > I am new to HBase, so it really means just 2 regions have been created,
> > right? It seems keys have been split in a half, 0000.. To ffff...
> >
> > I disabled, dropped and created the table again using the same command
> > bellow, then I saw 16 regions, as expected.
> >
> > Question 1: Is it possible to check the same thing using hbase shell?
> >
> > Question 2: Is it expected behavior the truncate messing up the splits?
> > What kind of DML operations could change the splits in my table? I am
> using
> > HBase 0.96.1.2.0.10.0-1-hadoop2
> >
> > -Marcelo
>



-- 
Sean

Re: table splitting - how to check

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Marcelo,

Truncate also removes the regions boundaries. You can use truncate_preserve
if you want to keep your region splits. Not sure if it's available in
0.96...

Also, I don't think you can look at the splits from the shell command...

JM

2015-02-25 10:09 GMT-05:00 Marcelo Valle (BLOOMBERG/ LONDON) <
mvallemilita@bloomberg.net>:

> Hi,
>
> I have created an HBase table just like that:
>
> t = create 'HBaseSerialWritesPOC', 'user_id_ts', {NAME => 'alnfo'},
> {SPLITS => ['100000000000000000000000', '200000000000000000000000',
> '300000000000000000000000', '400000000000000000000000',
> '500000000000000000000000', '600000000000000000000000',
> '700000000000000000000000', '800000000000000000000000',
> '900000000000000000000000', 'a00000000000000000000000',
> 'b00000000000000000000000', 'c00000000000000000000000',
> 'd00000000000000000000000', 'e00000000000000000000000',
> 'f00000000000000000000000']}
>
> After some tests, I truncated the table.
>
> Then I inserted 1 million rows, just to test. I was expecting to have 16
> regions for this table, but when I checked admin UI, I saw two regions:
>
> Table Regions
> Name       Region Server   Start Key       End Key Requests
> HBaseSerialWritesPOC,,1424873821297.cf92656f68a16e9696d0fbfe2494219b.
>   host1           800000190000125396f3f2bb        500625
> HBaseSerialWritesPOC,800000190000125396f3f2bb,1424873821297.696a25e590e3248005c638c0f86c0564.
> host2   800000190000125396f3f2bb                500621
>
> I am new to HBase, so it really means just 2 regions have been created,
> right? It seems keys have been split in a half, 0000.. To ffff...
>
> I disabled, dropped and created the table again using the same command
> bellow, then I saw 16 regions, as expected.
>
> Question 1: Is it possible to check the same thing using hbase shell?
>
> Question 2: Is it expected behavior the truncate messing up the splits?
> What kind of DML operations could change the splits in my table? I am using
> HBase 0.96.1.2.0.10.0-1-hadoop2
>
> -Marcelo