You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Alex Schultz (JIRA)" <ji...@apache.org> on 2012/07/16 15:42:35 UTC

[jira] [Comment Edited] (CASSANDRA-4439) Updating column family using cassandra-cli results in "Cannot modify index name"

    [ https://issues.apache.org/jira/browse/CASSANDRA-4439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13415111#comment-13415111 ] 

Alex Schultz edited comment on CASSANDRA-4439 at 7/16/12 1:41 PM:
------------------------------------------------------------------

Also despite the fact that it says you cannot rename the index, it will rename the index if you run the command and restart cassandra.  The exception does not stop the schema from being updated.  Also if you attempt to update the schema again with a corrected index name after it throws the exception, it will not accept it until you restart.  At which point your index name has already been changed to the first index name you attempted.

An example of this is:
{code}
create keyspace testing;
use testing;
create column family Album
with comparator = UTF8Type
and default_validation_class = UTF8Type
and column_metadata =
[
    {column_name: profileId, validation_class: UTF8Type, index_type: KEYS}
];

update column family Album
and column_metadata =
[
    {column_name: 'profileId', validation_class: UTF8Type, index_name: 'badindex', index_type: KEYS},
    {column_name: postedDate, validation_class: LongType}
];
{code}

The previous update will throw an exception and if you attempt to run the following it will still throw the exception:
{code}
update column family Album
and column_metadata =
[
    {column_name: 'profileId', validation_class: UTF8Type, index_name: 'Album_profileId_idx', index_type: KEYS},
    {column_name: postedDate, validation_class: LongType}
];
{code}

Also if you restart and do a show schema, your index is now named "badindex".
{code}

[default@testing] show schema;
create keyspace testing
  with placement_strategy = 'NetworkTopologyStrategy'
  and strategy_options = {datacenter1 : 1}
  and durable_writes = true;

use testing;

create column family Album
  with column_type = 'Standard'
  and comparator = 'UTF8Type'
  and default_validation_class = 'UTF8Type'
  and key_validation_class = 'BytesType'
  and read_repair_chance = 0.1
  and dclocal_read_repair_chance = 0.0
  and gc_grace = 864000
  and min_compaction_threshold = 4
  and max_compaction_threshold = 32
  and replicate_on_write = true
  and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
  and caching = 'KEYS_ONLY'
  and column_metadata = [
    {column_name : 'profileId',
    validation_class : UTF8Type,
    index_name : 'badindex',
    index_type : 0},
    {column_name : 'postedDate',
    validation_class : LongType}]
  and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'};
{code}
                
      was (Author: a.schultz):
    Also despite the fact that it says you cannot rename the index, it will rename the index if you run the command and restart cassandra.  The exception does not stop the schema from being updated.  Also if you attempt to update the schema again with a corrected index name after it throws the exception, it will not accept it until you restart.  At which point your index name has already been changed to the first index name you attempted.

An example of this is:
{code}
create keyspace testing;
use testing;
create column family Album
with comparator = UTF8Type
and default_validation_class = UTF8Type
and column_metadata =
[
    {column_name: profileId, validation_class: UTF8Type, index_type: KEYS}
];

update column family Album
and column_metadata =
[
    {column_name: 'profileId', validation_class: UTF8Type, index_name: 'badindex', index_type: KEYS},
    {column_name: postedDate, validation_class: LongType}
];
{code}

The previous update will throw an exception and if you attempt to run the following it will still throw the exception:
{code}
update column family Album
and column_metadata =
[
    {column_name: 'profileId', validation_class: UTF8Type, index_name: 'Album_profileId_idx', index_type: KEYS},
    {column_name: postedDate, validation_class: LongType}
];
{code}

Also if you restart and do a show schema, your index is now named "badindex".
{quote}

[default@testing] show schema;
create keyspace testing
  with placement_strategy = 'NetworkTopologyStrategy'
  and strategy_options = {datacenter1 : 1}
  and durable_writes = true;

use testing;

create column family Album
  with column_type = 'Standard'
  and comparator = 'UTF8Type'
  and default_validation_class = 'UTF8Type'
  and key_validation_class = 'BytesType'
  and read_repair_chance = 0.1
  and dclocal_read_repair_chance = 0.0
  and gc_grace = 864000
  and min_compaction_threshold = 4
  and max_compaction_threshold = 32
  and replicate_on_write = true
  and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
  and caching = 'KEYS_ONLY'
  and column_metadata = [
    {column_name : 'profileId',
    validation_class : UTF8Type,
    index_name : 'badindex',
    index_type : 0},
    {column_name : 'postedDate',
    validation_class : LongType}]
  and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'};
{quote}
                  
> Updating column family using cassandra-cli results in "Cannot modify index name"
> --------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-4439
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4439
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.2
>         Environment: cassandra 1.1.2, RHEL6.3, running under java-1.6.0-sun
>            Reporter: Alex Schultz
>            Priority: Minor
>
> Using cassandra-cli the following update to a column family worked in 1.1.0:
> {code}
> create keyspace testing;
> use testing;
> create column family Album
> with comparator = UTF8Type
> and default_validation_class = UTF8Type
> and column_metadata =
> [
>     {column_name: profileId, validation_class: UTF8Type, index_type: KEYS}
> ];
> update column family Album
> and column_metadata =
> [
>     {column_name: profileId, validation_class: UTF8Type, index_type: KEYS},
>     {column_name: postedDate, validation_class: LongType}
> ];
> {code}
> After upgrading to 1.1.2, the update statement fails with the following exception in system.log:
> {quote}
> ERROR [Thrift:16] 2012-07-13 14:51:54,558 CustomTThreadPoolServer.java (line 204) Error occurred during processing of message.
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.io.IOException: org.apache.cassandra.config.ConfigurationException: Cannot modify index name
>         at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:373)
>         at org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:188)
>         at org.apache.cassandra.service.MigrationManager.announceColumnFamilyUpdate(MigrationManager.java:161)
>         at org.apache.cassandra.thrift.CassandraServer.system_update_column_family(CassandraServer.java:1063)
>         at org.apache.cassandra.thrift.Cassandra$Processor$system_update_column_family.getResult(Cassandra.java:3520)
>         at org.apache.cassandra.thrift.Cassandra$Processor$system_update_column_family.getResult(Cassandra.java:3508)
>         at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>         at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>         at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:186)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: java.util.concurrent.ExecutionException: java.io.IOException: org.apache.cassandra.config.ConfigurationException: Cannot modify index name
>         at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
>         at java.util.concurrent.FutureTask.get(FutureTask.java:83)
>         at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:369)
>         ... 11 more
> Caused by: java.io.IOException: org.apache.cassandra.config.ConfigurationException: Cannot modify index name
>         at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:676)
>         at org.apache.cassandra.db.DefsTable.updateColumnFamily(DefsTable.java:463)
>         at org.apache.cassandra.db.DefsTable.mergeColumnFamilies(DefsTable.java:407)
>         at org.apache.cassandra.db.DefsTable.mergeSchema(DefsTable.java:271)
>         at org.apache.cassandra.service.MigrationManager$1.call(MigrationManager.java:211)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         ... 3 more
> Caused by: org.apache.cassandra.config.ConfigurationException: Cannot modify index name
>         at org.apache.cassandra.config.ColumnDefinition.apply(ColumnDefinition.java:214)
>         at org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:758)
>         at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:672)
>         ... 9 more
> ERROR [MigrationStage:1] 2012-07-13 14:51:54,561 AbstractCassandraDaemon.java (line 134) Exception in thread Thread[MigrationStage:1,5,main]
> java.io.IOException: org.apache.cassandra.config.ConfigurationException: Cannot modify index name
>         at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:676)
>         at org.apache.cassandra.db.DefsTable.updateColumnFamily(DefsTable.java:463)
>         at org.apache.cassandra.db.DefsTable.mergeColumnFamilies(DefsTable.java:407)
>         at org.apache.cassandra.db.DefsTable.mergeSchema(DefsTable.java:271)
>         at org.apache.cassandra.service.MigrationManager$1.call(MigrationManager.java:211)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: org.apache.cassandra.config.ConfigurationException: Cannot modify index name
>         at org.apache.cassandra.config.ColumnDefinition.apply(ColumnDefinition.java:214)
>         at org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:758)
>         at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:672)
>         ... 9 more
> {quote}
> After further testing the following works in 1.1.2:
> {code}
> create keyspace testing;
> use testing;
> create column family Album
> with comparator = UTF8Type
> and default_validation_class = UTF8Type
> and column_metadata =
> [
>     {column_name: profileId, validation_class: UTF8Type, index_name: 'Album_profileId_idx', index_type: KEYS}
> ];
> update column family Album
> and column_metadata =
> [
>     {column_name: profileId, validation_class: UTF8Type, index_name: 'Album_profileId_idx', index_type: KEYS},
>     {column_name: postedDate, validation_class: LongType}
> ];
> {code}
> So it appears that if you did not specify an index_name when creating the column originally, you cannot update the column family anymore.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira