You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by "Riesland, Zack" <Za...@sensus.com> on 2015/07/21 20:39:47 UTC

Help with secondary index

This is my first time messing with a secondary index in Phoenix.

I used this syntax:

create index fma_er_keyed_gz_endpoint_id_include_sample_point on fma.er_keyed_gz_meterkey_split_custid (endpoint_id) include (sample_point) SALT_BUCKETS = 550;

and I get this error:

[Error Code: 1029, SQL State: 42Y88]  ERROR 1029 (42Y88): Mutable secondary indexes must have the hbase.regionserver.wal.codec property set to org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec in the hbase-sites.xml of every region server tableName=FMA_ER_KEYED_GZ_ENDPOINT_ID_INCLUDE_SAMPLE_POINT

I have 2 questions and 1 (tiny) bug:

1) This table wasn't declared as immutable, but functionally, it is. Is there a way to alter the table to add the IMMUTABLE_ROWS property so that this will work? The table has over 10 billion rows, so I don't want to recreate it if I can help it.

2) My region servers have all the following hbase-site.xml files. Which one(s) do I alter? And do I need to restart hbase afterwards?

/etc/hbase/conf/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.1.GlusterFS/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.0.6.GlusterFS/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/1.3.2/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/HBASE/configuration/hbase-site.xml
/usr/hdp/2.2.0.0-2041/etc/hbase/conf.dist/hbase-site.xml
/usr/hdp/2.2.0.0-2041/phoenix/bin/hbase-site.xml

3) In the error message, hbase-sites.xml should be hbase-site.xml, correct?

Thanks!

RE: Help with secondary index

Posted by "Riesland, Zack" <Za...@sensus.com>.
Perfect.

One quick followup, if I can: should this work on a table with a ton of data in it?

My create index command ran for about 10 minutes, and then failed with this error: [CREATE - 0 row(s), 0.000 secs]  [Error Code: 101, SQL State: 08000]  null

Any ideas?

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Tuesday, July 21, 2015 2:51 PM
To: user
Subject: Re: Help with secondary index

For (1):
ALTER TABLE fma.er_keyed_gz_meterkey_split_custid SET IMMUTABLE_ROWS=true;

For (2):
You won't need that property if your table is immutable, but it'd still be good to add it for if/when you use mutable secondary indexes. Not sure which of those you'd need to add it to - maybe all of them to be safe? See https://phoenix.apache.org/secondary_indexing.html#Setup for a full list of properties you need

For (3):
Yes, should be hbase-site.xml. Thanks for letting us know.



On Tue, Jul 21, 2015 at 11:39 AM, Riesland, Zack <Za...@sensus.com>> wrote:
This is my first time messing with a secondary index in Phoenix.

I used this syntax:

create index fma_er_keyed_gz_endpoint_id_include_sample_point on fma.er_keyed_gz_meterkey_split_custid (endpoint_id) include (sample_point) SALT_BUCKETS = 550;

and I get this error:

[Error Code: 1029, SQL State: 42Y88]  ERROR 1029 (42Y88): Mutable secondary indexes must have the hbase.regionserver.wal.codec property set to org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec in the hbase-sites.xml of every region server tableName=FMA_ER_KEYED_GZ_ENDPOINT_ID_INCLUDE_SAMPLE_POINT

I have 2 questions and 1 (tiny) bug:

1) This table wasn’t declared as immutable, but functionally, it is. Is there a way to alter the table to add the IMMUTABLE_ROWS property so that this will work? The table has over 10 billion rows, so I don’t want to recreate it if I can help it.

2) My region servers have all the following hbase-site.xml files. Which one(s) do I alter? And do I need to restart hbase afterwards?

/etc/hbase/conf/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.1.GlusterFS/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.0.6.GlusterFS/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/1.3.2/services/HBASE/configuration/hbase-site.xml
/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/HBASE/configuration/hbase-site.xml
/usr/hdp/2.2.0.0-2041/etc/hbase/conf.dist/hbase-site.xml
/usr/hdp/2.2.0.0-2041/phoenix/bin/hbase-site.xml

3) In the error message, hbase-sites.xml should be hbase-site.xml, correct?

Thanks!


Re: Help with secondary index

Posted by James Taylor <ja...@apache.org>.
For (1):
ALTER TABLE fma.er_keyed_gz_meterkey_split_custid SET IMMUTABLE_ROWS=true;

For (2):
You won't need that property if your table is immutable, but it'd still be
good to add it for if/when you use mutable secondary indexes. Not sure
which of those you'd need to add it to - maybe all of them to be safe? See
https://phoenix.apache.org/secondary_indexing.html#Setup for a full list of
properties you need

For (3):
Yes, should be hbase-site.xml. Thanks for letting us know.



On Tue, Jul 21, 2015 at 11:39 AM, Riesland, Zack <Za...@sensus.com>
wrote:

>  This is my first time messing with a secondary index in Phoenix.
>
>
>
> I used this syntax:
>
>
>
> create index fma_er_keyed_gz_endpoint_id_include_sample_point on
> fma.er_keyed_gz_meterkey_split_custid (endpoint_id) include (sample_point)
> SALT_BUCKETS = 550;
>
>
>
> and I get this error:
>
>
>
> [Error Code: 1029, SQL State: 42Y88]  ERROR 1029 (42Y88): Mutable
> secondary indexes must have the hbase.regionserver.wal.codec property set
> to org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec in the
> hbase-sites.xml of every region server
> tableName=FMA_ER_KEYED_GZ_ENDPOINT_ID_INCLUDE_SAMPLE_POINT
>
>
>
> I have 2 questions and 1 (tiny) bug:
>
>
>
> 1) This table wasn’t declared as immutable, but functionally, it is. Is
> there a way to alter the table to add the IMMUTABLE_ROWS property so that
> this will work? The table has over 10 billion rows, so I don’t want to
> recreate it if I can help it.
>
>
>
> 2) My region servers have all the following hbase-site.xml files. Which
> one(s) do I alter? And do I need to restart hbase afterwards?
>
>
>
> /etc/hbase/conf/hbase-site.xml
>
>
> /var/lib/ambari-agent/cache/stacks/HDP/2.1.GlusterFS/services/HBASE/configuration/hbase-site.xml
>
>
> /var/lib/ambari-agent/cache/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
>
>
> /var/lib/ambari-agent/cache/stacks/HDP/2.0.6.GlusterFS/services/HBASE/configuration/hbase-site.xml
>
>
> /var/lib/ambari-agent/cache/stacks/HDP/1.3.2/services/HBASE/configuration/hbase-site.xml
>
>
> /var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/HBASE/configuration/hbase-site.xml
>
> /usr/hdp/2.2.0.0-2041/etc/hbase/conf.dist/hbase-site.xml
>
> /usr/hdp/2.2.0.0-2041/phoenix/bin/hbase-site.xml
>
>
>
> 3) In the error message, hbase-sites.xml should be hbase-site.xml, correct?
>
>
>
> Thanks!
>