[ 
https://issues.apache.org/jira/browse/CASSANDRA-6705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-6705:
----------------------------------------

    Attachment: 6705-2.txt

We definitively should add a proper isCompatibleWith method for CollectionType. 
 If we do so however, it means we'll allow altering the type of a collection 
column, which is a good thing, but is not handle properly currently because 
collection type are aliases in the comparator and so we must make sure we 
propagate a change to the comparator too. That case (altering a collection and 
not propagating it to the comparator) is also not handled by AlterTypeStatement 
currently. This also revealed a bug in ColumnToCollectionType.isCompatibleWith 
which has arguments inverted when calling isCompatibleWith on the collection it 
contains (it didn't matter so far since isCompatibleWith was equality until 
this patch).

On the added isCompatibleWith, 2 remarks:
# we shouldn't consider 2 different collection compatible, so previous should 
not just be a CollectionType but really of the same class than {{this}}.
# for the valueComparator, we can use isValueCompatibleWith since we know it's 
always applied to a cell value and thus preserving the sort order is not 
required.

Attaching a v2 that handle the remarks above. I've pushed [some 
dtests|https://github.com/riptano/cassandra-dtest/commit/b208cd6462b823d400e131339ab10911ab570297]
 for this too.


> ALTER TYPE <type> RENAME <field> fails sometime with 
> java.lang.AssertionError: null
> -----------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-6705
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6705
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: trunk
>            Reporter: Mikhail Stepura
>            Assignee: Mikhail Stepura
>            Priority: Minor
>             Fix For: 2.1 beta2
>
>         Attachments: 6705-2.txt, trunk-6705.patch
>
>
> Here are the steps w
> {code}
> cqlsh> create KEYSPACE bug WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};
> cqlsh>
> cqlsh>
> cqlsh> use bug;
> cqlsh:bug> create type first_type (first_field int);
> cqlsh:bug> create type second_type (second_field list<first_type >);
> cqlsh:bug> alter type first_type RENAME first_field TO first_fieldd;
> TSocket read 0 bytes
> {code}
> And here is from the C* side: 
> {code}
> NFO  05:11:54 Loading 
> org.apache.cassandra.db.marshal.UserType(bug,7365636f6e645f74797065,7365636f6e645f6669656c64:org.apache.cassandra.db.marshal.ListType(org.apache.cassandra.db.marshal.UserType(bug,66697273745f74797065,66697273745f6669656c6464:org.apache.cassandra.db.marshal.Int32Type)))
> INFO  05:11:54 Compacted 4 sstables to 
> [/var/lib/cassandra/data/system/schema_usertypes-3aa752254f82350b8d5c430fa221fa0a/system-schema_usertypes-ka-5,].
>   908 bytes to 425 (~46% of original) in 12ms = 0.033776MB/s.  4 total 
> partitions merged to 1.  Partition merge counts were {4:1, }
> ERROR 05:11:54 Exception in thread Thread[MigrationStage:1,5,main]
> java.lang.AssertionError: null
>       at org.apache.cassandra.config.UTMetaData.addType(UTMetaData.java:145) 
> ~[main/:na]
>       at org.apache.cassandra.db.DefsTables.addType(DefsTables.java:412) 
> ~[main/:na]
>       at org.apache.cassandra.db.DefsTables.mergeTypes(DefsTables.java:365) 
> ~[main/:na]
>       at org.apache.cassandra.db.DefsTables.mergeSchema(DefsTables.java:182) 
> ~[main/:na]
>       at 
> org.apache.cassandra.service.MigrationManager$2.runMayThrow(MigrationManager.java:299)
>  ~[main/:na]
>       at 
> org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) 
> ~[main/:na]
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
> ~[na:1.7.0_51]
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
> ~[na:1.7.0_51]
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  ~[na:1.7.0_51]
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_51]
>       at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
> ERROR 05:11:54 Error occurred during processing of message.
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
> java.lang.AssertionError
>       at 
> org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:411) 
> ~[main/:na]
>       at 
> org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:281)
>  ~[main/:na]
>       at 
> org.apache.cassandra.service.MigrationManager.announceNewType(MigrationManager.java:216)
>  ~[main/:na]
>       at 
> org.apache.cassandra.service.MigrationManager.announceTypeUpdate(MigrationManager.java:247)
>  ~[main/:na]
>       at 
> org.apache.cassandra.cql3.statements.AlterTypeStatement.announceMigration(AlterTypeStatement.java:139)
>  ~[main/:na]
>       at 
> org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:71)
>  ~[main/:na]
>       at 
> org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:180)
>  ~[main/:na]
>       at 
> org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:214) 
> ~[main/:na]
>       at 
> org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:204) 
> ~[main/:na]
>       at 
> org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1973)
>  ~[main/:na]
>       at 
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4486)
>  ~[thrift/:na]
>       at 
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4470)
>  ~[thrift/:na]
>       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) 
> ~[libthrift-0.9.1.jar:0.9.1]
>       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) 
> ~[libthrift-0.9.1.jar:0.9.1]
>       at 
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:194)
>  ~[main/:na]
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_51]
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_51]
>       at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
> Caused by: java.util.concurrent.ExecutionException: java.lang.AssertionError
>       at java.util.concurrent.FutureTask.report(FutureTask.java:122) 
> ~[na:1.7.0_51]
>       at java.util.concurrent.FutureTask.get(FutureTask.java:188) 
> ~[na:1.7.0_51]
>       at 
> org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:407) 
> ~[main/:na]
>       ... 17 common frames omitted
> Caused by: java.lang.AssertionError: null
>       at org.apache.cassandra.config.UTMetaData.addType(UTMetaData.java:145) 
> ~[main/:na]
>       at org.apache.cassandra.db.DefsTables.addType(DefsTables.java:412) 
> ~[main/:na]
>       at org.apache.cassandra.db.DefsTables.mergeTypes(DefsTables.java:365) 
> ~[main/:na]
>       at org.apache.cassandra.db.DefsTables.mergeSchema(DefsTables.java:182) 
> ~[main/:na]
>       at 
> org.apache.cassandra.service.MigrationManager$2.runMayThrow(MigrationManager.java:299)
>  ~[main/:na]
>       at 
> org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) 
> ~[main/:na]
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
> ~[na:1.7.0_51]
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
> ~[na:1.7.0_51]
>       ... 3 common frames omitted
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to