You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Dan Kuebrich <da...@gmail.com> on 2011/08/16 16:12:53 UTC

dropping secondary indexes

I think I've dropped all the indexes on a CF, but I see traces of them in
the CLI output of show keyspaces.  I see a few validators left behind, and
one "built index".  (output below)

1. Is there a better way to check schema for indexes?
2. I can't drop the "built" one so I assume they're all gone?  If so, what
is the remaining index listing?
3. Do validators incur any performance penalties?  They're no longer
necessary (the named columns are not even written anymore).

    ColumnFamily: MyCF
      Key Validation Class: org.apache.cassandra.db.marshal.BytesType
      Default column value validator:
org.apache.cassandra.db.marshal.BytesType
      Columns sorted by: org.apache.cassandra.db.marshal.BytesType
      Row cache size / save period in seconds: 2000.0/0
      Key cache size / save period in seconds: 200000.0/14400
      Memtable thresholds: 1.1203125/1440/239 (millions of ops/minutes/MB)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 1.0
      Replicate on write: false
      Built indexes: [MyCF.MyCF_617070_idx]
      Column Metadata:
        Column Name: col1 (6167656e74)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
        Column Name: col2 (617070)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
          Index Name: MyCF_617070_idx
          Index Type: KEYS
        Column Name: col3 (686f7374)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
        Column Name: col4 (686f73745f6964)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
        Column Name: col5 (696d706c)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
        Column Name: col6 (706572696f64)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type

Re: dropping secondary indexes

Posted by Dan Kuebrich <da...@gmail.com>.
https://issues.apache.org/jira/browse/CASSANDRA-3054

On Wed, Aug 17, 2011 at 7:13 PM, aaron morton <aa...@thelastpickle.com>wrote:

> ooo, didn't know there was a drop index statement.
>
> I got the same result, the Antlr grammar seems to say it's a valid
> identifier (not that I have much Antlr foo)…
>
>
> Identifier
>     : (Letter | Alnum) (Alnum | '_' | '-' )*
>
> fragment
> Letter
>     : 'a'..'z'
>     | 'A'..'Z'
>     ;
>
> fragment
> Digit
>     : '0'..'9'
>     ;
>
> fragment
> Alnum
>     : Letter
>     | Digit
>     ;
>
> Could you raise a bug for it.
>
> In the mean time I was able to drop the index as follows…
>
> create column family Standard4
>     with comparator = BytesType
>     and column_metadata =
>     [{
>         column_name : 617070,
>         validation_class : IntegerType,
>         index_type : 0,
>         index_name : IdxName},
>     {
>         column_name : 'other name',
>         validation_class : LongType
>     }];
>
>     update column family Standard4
>     with comparator = BytesType
>     and column_metadata =
>     [
>     {
>         column_name : 'other name',
>         validation_class : LongType
>     }];
>
>
> Cheers
>
>  -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 18/08/2011, at 3:16 AM, Dan Kuebrich wrote:
>
> Thanks, Aaron!  In terms of dropping stuff from the CLI, I tried to re-drop
> the remaining built column index and get the following error message.  I
> wonder if there's some sort of parser bug related to numeric vs alpha
> tokens.  The column name below is col2 from the show keyspace dump earlier
> in the thread, though I understand the hex value should be used for dropping
> columns.
>
> [default@Tracelytics] use MyKeyspace;
> Authenticated to keyspace: MyKeyspace
> [default@Tracelytics] drop index on MyCF.617070;
> Syntax error at position 22: mismatched input '617070' expecting Identifier
>
> CLI drop index worked for all the columns with hex letters in them, and in
> fact adding an alpha char here changes the message:
>
> [default@Tracelytics] drop index on MyCF.617070x;
> Column '617070x' definition was not found in ColumnFamily 'MyCF'.
> [default@Tracelytics] drop index on Rollups.col2;
> Column 'col2' definition was not found in ColumnFamily 'MyCF'.
>
>
> On Tue, Aug 16, 2011 at 7:29 PM, aaron morton <aa...@thelastpickle.com>wrote:
>
>> > I think I've dropped all the indexes on a CF, but I see traces of them
>> in the CLI output of show keyspaces.  I see a few validators left behind,
>> and one "built index".  (output below)
>> What process did you use to drop the indexes ? You need to use  update
>> column family and not include the column meta data.
>>
>> > 1. Is there a better way to check schema for indexes?
>> Thats the way. You can also look in JConsole. If you see things that seem
>> odd check the cluster agrees on the schema using describe cluster in the
>> CLI.
>>
>> > 3. Do validators incur any performance penalties?  They're no longer
>> necessary (the named columns are not even written anymore).
>>
>> There is a minor over head, but only if the named column is updated.
>>
>> Cheers
>>
>> -----------------
>> Aaron Morton
>> Freelance Cassandra Developer
>> @aaronmorton
>> http://www.thelastpickle.com
>>
>> On 17/08/2011, at 2:12 AM, Dan Kuebrich wrote:
>>
>> > I think I've dropped all the indexes on a CF, but I see traces of them
>> in the CLI output of show keyspaces.  I see a few validators left behind,
>> and one "built index".  (output below)
>> >
>> > 1. Is there a better way to check schema for indexes?
>> > 2. I can't drop the "built" one so I assume they're all gone?  If so,
>> what is the remaining index listing?
>> > 3. Do validators incur any performance penalties?  They're no longer
>> necessary (the named columns are not even written anymore).
>> >
>> >     ColumnFamily: MyCF
>> >       Key Validation Class: org.apache.cassandra.db.marshal.BytesType
>> >       Default column value validator:
>> org.apache.cassandra.db.marshal.BytesType
>> >       Columns sorted by: org.apache.cassandra.db.marshal.BytesType
>> >       Row cache size / save period in seconds: 2000.0/0
>> >       Key cache size / save period in seconds: 200000.0/14400
>> >       Memtable thresholds: 1.1203125/1440/239 (millions of
>> ops/minutes/MB)
>> >       GC grace seconds: 864000
>> >       Compaction min/max thresholds: 4/32
>> >       Read repair chance: 1.0
>> >       Replicate on write: false
>> >       Built indexes: [MyCF.MyCF_617070_idx]
>> >       Column Metadata:
>> >         Column Name: col1 (6167656e74)
>> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>> >         Column Name: col2 (617070)
>> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>> >           Index Name: MyCF_617070_idx
>> >           Index Type: KEYS
>> >         Column Name: col3 (686f7374)
>> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>> >         Column Name: col4 (686f73745f6964)
>> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>> >         Column Name: col5 (696d706c)
>> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>> >         Column Name: col6 (706572696f64)
>> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>>
>>
>
>

Re: dropping secondary indexes

Posted by aaron morton <aa...@thelastpickle.com>.
ooo, didn't know there was a drop index statement. 

I got the same result, the Antlr grammar seems to say it's a valid identifier (not that I have much Antlr foo)…


Identifier
    : (Letter | Alnum) (Alnum | '_' | '-' )*

fragment
Letter
    : 'a'..'z' 
    | 'A'..'Z'
    ;

fragment
Digit
    : '0'..'9'
    ;

fragment
Alnum
    : Letter
    | Digit
    ;

Could you raise a bug for it. 

In the mean time I was able to drop the index as follows…

create column family Standard4
    with comparator = BytesType
    and column_metadata =
    [{
        column_name : 617070,
        validation_class : IntegerType,
        index_type : 0,
        index_name : IdxName},
    {
        column_name : 'other name',
        validation_class : LongType
    }];

    update column family Standard4
    with comparator = BytesType
    and column_metadata =
    [
    {
        column_name : 'other name',
        validation_class : LongType
    }];
    

Cheers
 
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com

On 18/08/2011, at 3:16 AM, Dan Kuebrich wrote:

> Thanks, Aaron!  In terms of dropping stuff from the CLI, I tried to re-drop the remaining built column index and get the following error message.  I wonder if there's some sort of parser bug related to numeric vs alpha tokens.  The column name below is col2 from the show keyspace dump earlier in the thread, though I understand the hex value should be used for dropping columns.
> 
> [default@Tracelytics] use MyKeyspace;
> Authenticated to keyspace: MyKeyspace
> [default@Tracelytics] drop index on MyCF.617070; 
> Syntax error at position 22: mismatched input '617070' expecting Identifier
> 
> CLI drop index worked for all the columns with hex letters in them, and in fact adding an alpha char here changes the message:
> 
> [default@Tracelytics] drop index on MyCF.617070x;
> Column '617070x' definition was not found in ColumnFamily 'MyCF'.
> [default@Tracelytics] drop index on Rollups.col2;
> Column 'col2' definition was not found in ColumnFamily 'MyCF'.
> 
> 
> On Tue, Aug 16, 2011 at 7:29 PM, aaron morton <aa...@thelastpickle.com> wrote:
> > I think I've dropped all the indexes on a CF, but I see traces of them in the CLI output of show keyspaces.  I see a few validators left behind, and one "built index".  (output below)
> What process did you use to drop the indexes ? You need to use  update column family and not include the column meta data.
> 
> > 1. Is there a better way to check schema for indexes?
> Thats the way. You can also look in JConsole. If you see things that seem odd check the cluster agrees on the schema using describe cluster in the CLI.
> 
> > 3. Do validators incur any performance penalties?  They're no longer necessary (the named columns are not even written anymore).
> 
> There is a minor over head, but only if the named column is updated.
> 
> Cheers
> 
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
> 
> On 17/08/2011, at 2:12 AM, Dan Kuebrich wrote:
> 
> > I think I've dropped all the indexes on a CF, but I see traces of them in the CLI output of show keyspaces.  I see a few validators left behind, and one "built index".  (output below)
> >
> > 1. Is there a better way to check schema for indexes?
> > 2. I can't drop the "built" one so I assume they're all gone?  If so, what is the remaining index listing?
> > 3. Do validators incur any performance penalties?  They're no longer necessary (the named columns are not even written anymore).
> >
> >     ColumnFamily: MyCF
> >       Key Validation Class: org.apache.cassandra.db.marshal.BytesType
> >       Default column value validator: org.apache.cassandra.db.marshal.BytesType
> >       Columns sorted by: org.apache.cassandra.db.marshal.BytesType
> >       Row cache size / save period in seconds: 2000.0/0
> >       Key cache size / save period in seconds: 200000.0/14400
> >       Memtable thresholds: 1.1203125/1440/239 (millions of ops/minutes/MB)
> >       GC grace seconds: 864000
> >       Compaction min/max thresholds: 4/32
> >       Read repair chance: 1.0
> >       Replicate on write: false
> >       Built indexes: [MyCF.MyCF_617070_idx]
> >       Column Metadata:
> >         Column Name: col1 (6167656e74)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col2 (617070)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >           Index Name: MyCF_617070_idx
> >           Index Type: KEYS
> >         Column Name: col3 (686f7374)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col4 (686f73745f6964)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col5 (696d706c)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col6 (706572696f64)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> 
> 


Re: dropping secondary indexes

Posted by Dan Kuebrich <da...@gmail.com>.
Thanks, Aaron!  In terms of dropping stuff from the CLI, I tried to re-drop
the remaining built column index and get the following error message.  I
wonder if there's some sort of parser bug related to numeric vs alpha
tokens.  The column name below is col2 from the show keyspace dump earlier
in the thread, though I understand the hex value should be used for dropping
columns.

[default@Tracelytics] use MyKeyspace;
Authenticated to keyspace: MyKeyspace
[default@Tracelytics] drop index on MyCF.617070;
Syntax error at position 22: mismatched input '617070' expecting Identifier

CLI drop index worked for all the columns with hex letters in them, and in
fact adding an alpha char here changes the message:

[default@Tracelytics] drop index on MyCF.617070x;
Column '617070x' definition was not found in ColumnFamily 'MyCF'.
[default@Tracelytics] drop index on Rollups.col2;
Column 'col2' definition was not found in ColumnFamily 'MyCF'.


On Tue, Aug 16, 2011 at 7:29 PM, aaron morton <aa...@thelastpickle.com>wrote:

> > I think I've dropped all the indexes on a CF, but I see traces of them in
> the CLI output of show keyspaces.  I see a few validators left behind, and
> one "built index".  (output below)
> What process did you use to drop the indexes ? You need to use  update
> column family and not include the column meta data.
>
> > 1. Is there a better way to check schema for indexes?
> Thats the way. You can also look in JConsole. If you see things that seem
> odd check the cluster agrees on the schema using describe cluster in the
> CLI.
>
> > 3. Do validators incur any performance penalties?  They're no longer
> necessary (the named columns are not even written anymore).
>
> There is a minor over head, but only if the named column is updated.
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 17/08/2011, at 2:12 AM, Dan Kuebrich wrote:
>
> > I think I've dropped all the indexes on a CF, but I see traces of them in
> the CLI output of show keyspaces.  I see a few validators left behind, and
> one "built index".  (output below)
> >
> > 1. Is there a better way to check schema for indexes?
> > 2. I can't drop the "built" one so I assume they're all gone?  If so,
> what is the remaining index listing?
> > 3. Do validators incur any performance penalties?  They're no longer
> necessary (the named columns are not even written anymore).
> >
> >     ColumnFamily: MyCF
> >       Key Validation Class: org.apache.cassandra.db.marshal.BytesType
> >       Default column value validator:
> org.apache.cassandra.db.marshal.BytesType
> >       Columns sorted by: org.apache.cassandra.db.marshal.BytesType
> >       Row cache size / save period in seconds: 2000.0/0
> >       Key cache size / save period in seconds: 200000.0/14400
> >       Memtable thresholds: 1.1203125/1440/239 (millions of
> ops/minutes/MB)
> >       GC grace seconds: 864000
> >       Compaction min/max thresholds: 4/32
> >       Read repair chance: 1.0
> >       Replicate on write: false
> >       Built indexes: [MyCF.MyCF_617070_idx]
> >       Column Metadata:
> >         Column Name: col1 (6167656e74)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col2 (617070)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >           Index Name: MyCF_617070_idx
> >           Index Type: KEYS
> >         Column Name: col3 (686f7374)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col4 (686f73745f6964)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col5 (696d706c)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> >         Column Name: col6 (706572696f64)
> >           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>
>

Re: dropping secondary indexes

Posted by aaron morton <aa...@thelastpickle.com>.
> I think I've dropped all the indexes on a CF, but I see traces of them in the CLI output of show keyspaces.  I see a few validators left behind, and one "built index".  (output below)
What process did you use to drop the indexes ? You need to use  update column family and not include the column meta data.

> 1. Is there a better way to check schema for indexes?
Thats the way. You can also look in JConsole. If you see things that seem odd check the cluster agrees on the schema using describe cluster in the CLI. 

> 3. Do validators incur any performance penalties?  They're no longer necessary (the named columns are not even written anymore).

There is a minor over head, but only if the named column is updated. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com

On 17/08/2011, at 2:12 AM, Dan Kuebrich wrote:

> I think I've dropped all the indexes on a CF, but I see traces of them in the CLI output of show keyspaces.  I see a few validators left behind, and one "built index".  (output below)
> 
> 1. Is there a better way to check schema for indexes?
> 2. I can't drop the "built" one so I assume they're all gone?  If so, what is the remaining index listing?
> 3. Do validators incur any performance penalties?  They're no longer necessary (the named columns are not even written anymore).
> 
>     ColumnFamily: MyCF
>       Key Validation Class: org.apache.cassandra.db.marshal.BytesType
>       Default column value validator: org.apache.cassandra.db.marshal.BytesType
>       Columns sorted by: org.apache.cassandra.db.marshal.BytesType
>       Row cache size / save period in seconds: 2000.0/0
>       Key cache size / save period in seconds: 200000.0/14400
>       Memtable thresholds: 1.1203125/1440/239 (millions of ops/minutes/MB)
>       GC grace seconds: 864000
>       Compaction min/max thresholds: 4/32
>       Read repair chance: 1.0
>       Replicate on write: false
>       Built indexes: [MyCF.MyCF_617070_idx]
>       Column Metadata:
>         Column Name: col1 (6167656e74)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>         Column Name: col2 (617070)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>           Index Name: MyCF_617070_idx
>           Index Type: KEYS
>         Column Name: col3 (686f7374)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>         Column Name: col4 (686f73745f6964)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>         Column Name: col5 (696d706c)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>         Column Name: col6 (706572696f64)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type