You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Jacques-Henri Berthemet <ja...@genesys.com> on 2016/03/04 14:45:29 UTC

Updating secondary index options

Hi,

I'm using Cassandra 2.2.5 with a custom secondary index. It's created with the below syntax:
https://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_index_r.html
CREATE CUSTOM INDEX ON users (email) USING 'path.to.the.IndexClass' WITH OPTIONS = {'some_setting': 'value'};
I'd like to update those settings, I tried the below command based on ALTER TABLE but it does not work:
cqlsh:test> alter index table_idx WITH OPTIONS = {'some_setting': 'value'};
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:6 no viable alternative at input 'index' ([alter] index...)">

Is there a way to send such updates?

Regards,
Jacques-Henri


RE: Updating secondary index options

Posted by Jacques-Henri Berthemet <ja...@genesys.com>.
Indeed it’s a custom implementation of PerRowSecondaryIndex, in my case I know it’s safe to update the particular setting I want update, and it won’t rebuild the index, just provide the ability to tune some settings.

Even on regular Cassandra indexes that are based on SSTables you could want to update read_repair_chance, sstable_compression, compaction, caching …

I created the below Jira “Wish”:
CASSANDRA-11306<https://issues.apache.org/jira/browse/CASSANDRA-11306> Add support for ALTER INDEX command

For now I’ll have to hack something indeed. I tried to update system tables that holds index options but it seems I need to restart Cassandra twice to be able to see the changes.

Regards,
--
Jacques-Henri Berthemet

From: Jack Krupansky [mailto:jack.krupansky@gmail.com]
Sent: vendredi 4 mars 2016 18:40
To: user@cassandra.apache.org
Subject: Re: Updating secondary index options

Is this a secondary indexer of your own design so that you know that changing the options will be safe for existing index entries?

It might be worth a Jira.

Otherwise, you may jus have to manually go in and hack the information under the hood.

-- Jack Krupansky

On Fri, Mar 4, 2016 at 12:14 PM, DuyHai Doan <do...@gmail.com>> wrote:
Unfortunately for you, ALTER INDEX does not exist.

And anyway, even if it exists, altering an index option is going likely to require index rebuild so you can't cut it anyway

On Fri, Mar 4, 2016 at 4:59 PM, Jacques-Henri Berthemet <ja...@genesys.com>> wrote:
It’s not possible, it’s a PerRowSecondary index, potentially as big as the table itself (few TBs) it will take a very long time to drop and re-create.

--
Jacques-Henri Berthemet

From: DuyHai Doan [mailto:doanduyhai@gmail.com<ma...@gmail.com>]
Sent: vendredi 4 mars 2016 14:52
To: user@cassandra.apache.org<ma...@cassandra.apache.org>
Subject: Re: Updating secondary index options

DROP and re-create the index with the new options

On Fri, Mar 4, 2016 at 3:45 PM, Jacques-Henri Berthemet <ja...@genesys.com>> wrote:
Hi,

I’m using Cassandra 2.2.5 with a custom secondary index. It’s created with the below syntax:
https://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_index_r.html
CREATE CUSTOM INDEX ON users (email) USING 'path.to.the.IndexClass' WITH OPTIONS = {'some_setting': 'value'};
I’d like to update those settings, I tried the below command based on ALTER TABLE but it does not work:
cqlsh:test> alter index table_idx WITH OPTIONS = {'some_setting': 'value'};
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:6 no viable alternative at input 'index' ([alter] index...)">

Is there a way to send such updates?

Regards,
Jacques-Henri





Re: Updating secondary index options

Posted by Jack Krupansky <ja...@gmail.com>.
Is this a secondary indexer of your own design so that you know that
changing the options will be safe for existing index entries?

It might be worth a Jira.

Otherwise, you may jus have to manually go in and hack the information
under the hood.

-- Jack Krupansky

On Fri, Mar 4, 2016 at 12:14 PM, DuyHai Doan <do...@gmail.com> wrote:

> Unfortunately for you, ALTER INDEX does not exist.
>
> And anyway, even if it exists, altering an index option is going likely to
> require index rebuild so you can't cut it anyway
>
> On Fri, Mar 4, 2016 at 4:59 PM, Jacques-Henri Berthemet <
> jacques-henri.berthemet@genesys.com> wrote:
>
>> It’s not possible, it’s a PerRowSecondary index, potentially as big as
>> the table itself (few TBs) it will take a very long time to drop and
>> re-create.
>>
>>
>>
>> *--*
>>
>> *Jacques-Henri Berthemet*
>>
>>
>>
>> *From:* DuyHai Doan [mailto:doanduyhai@gmail.com]
>> *Sent:* vendredi 4 mars 2016 14:52
>> *To:* user@cassandra.apache.org
>> *Subject:* Re: Updating secondary index options
>>
>>
>>
>> DROP and re-create the index with the new options
>>
>>
>>
>> On Fri, Mar 4, 2016 at 3:45 PM, Jacques-Henri Berthemet <
>> jacques-henri.berthemet@genesys.com> wrote:
>>
>> Hi,
>>
>>
>>
>> I’m using Cassandra 2.2.5 with a custom secondary index. It’s created
>> with the below syntax:
>>
>> https://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_index_r.html
>>
>> *CREATE* *CUSTOM* *INDEX* *ON* *users* (email) *USING*
>> 'path.to.the.IndexClass' *WITH* OPTIONS = {'some_setting': 'value'};
>>
>> I’d like to update those settings, I tried the below command based on
>> ALTER TABLE but it does not work:
>>
>> cqlsh:test> alter index table_idx WITH OPTIONS = {'some_setting':
>> 'value'};
>>
>> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query]
>> message="line 1:6 no viable alternative at input 'index' ([alter]
>> index...)">
>>
>>
>>
>> Is there a way to send such updates?
>>
>>
>>
>> Regards,
>>
>> Jacques-Henri
>>
>>
>>
>>
>>
>
>

Re: Updating secondary index options

Posted by DuyHai Doan <do...@gmail.com>.
Unfortunately for you, ALTER INDEX does not exist.

And anyway, even if it exists, altering an index option is going likely to
require index rebuild so you can't cut it anyway

On Fri, Mar 4, 2016 at 4:59 PM, Jacques-Henri Berthemet <
jacques-henri.berthemet@genesys.com> wrote:

> It’s not possible, it’s a PerRowSecondary index, potentially as big as the
> table itself (few TBs) it will take a very long time to drop and re-create.
>
>
>
> *--*
>
> *Jacques-Henri Berthemet*
>
>
>
> *From:* DuyHai Doan [mailto:doanduyhai@gmail.com]
> *Sent:* vendredi 4 mars 2016 14:52
> *To:* user@cassandra.apache.org
> *Subject:* Re: Updating secondary index options
>
>
>
> DROP and re-create the index with the new options
>
>
>
> On Fri, Mar 4, 2016 at 3:45 PM, Jacques-Henri Berthemet <
> jacques-henri.berthemet@genesys.com> wrote:
>
> Hi,
>
>
>
> I’m using Cassandra 2.2.5 with a custom secondary index. It’s created with
> the below syntax:
>
> https://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_index_r.html
>
> *CREATE* *CUSTOM* *INDEX* *ON* *users* (email) *USING*
> 'path.to.the.IndexClass' *WITH* OPTIONS = {'some_setting': 'value'};
>
> I’d like to update those settings, I tried the below command based on
> ALTER TABLE but it does not work:
>
> cqlsh:test> alter index table_idx WITH OPTIONS = {'some_setting': 'value'};
>
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query]
> message="line 1:6 no viable alternative at input 'index' ([alter]
> index...)">
>
>
>
> Is there a way to send such updates?
>
>
>
> Regards,
>
> Jacques-Henri
>
>
>
>
>

RE: Updating secondary index options

Posted by Jacques-Henri Berthemet <ja...@genesys.com>.
It’s not possible, it’s a PerRowSecondary index, potentially as big as the table itself (few TBs) it will take a very long time to drop and re-create.

--
Jacques-Henri Berthemet

From: DuyHai Doan [mailto:doanduyhai@gmail.com]
Sent: vendredi 4 mars 2016 14:52
To: user@cassandra.apache.org
Subject: Re: Updating secondary index options

DROP and re-create the index with the new options

On Fri, Mar 4, 2016 at 3:45 PM, Jacques-Henri Berthemet <ja...@genesys.com>> wrote:
Hi,

I’m using Cassandra 2.2.5 with a custom secondary index. It’s created with the below syntax:
https://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_index_r.html
CREATE CUSTOM INDEX ON users (email) USING 'path.to.the.IndexClass' WITH OPTIONS = {'some_setting': 'value'};
I’d like to update those settings, I tried the below command based on ALTER TABLE but it does not work:
cqlsh:test> alter index table_idx WITH OPTIONS = {'some_setting': 'value'};
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:6 no viable alternative at input 'index' ([alter] index...)">

Is there a way to send such updates?

Regards,
Jacques-Henri



Re: Updating secondary index options

Posted by DuyHai Doan <do...@gmail.com>.
DROP and re-create the index with the new options

On Fri, Mar 4, 2016 at 3:45 PM, Jacques-Henri Berthemet <
jacques-henri.berthemet@genesys.com> wrote:

> Hi,
>
>
>
> I’m using Cassandra 2.2.5 with a custom secondary index. It’s created with
> the below syntax:
>
> https://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_index_r.html
>
> *CREATE* *CUSTOM* *INDEX* *ON* *users* (email) *USING*
> 'path.to.the.IndexClass' *WITH* OPTIONS = {'some_setting': 'value'};
>
> I’d like to update those settings, I tried the below command based on
> ALTER TABLE but it does not work:
>
> cqlsh:test> alter index table_idx WITH OPTIONS = {'some_setting': 'value'};
>
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query]
> message="line 1:6 no viable alternative at input 'index' ([alter]
> index...)">
>
>
>
> Is there a way to send such updates?
>
>
>
> Regards,
>
> Jacques-Henri
>
>
>