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

Russ Hatch edited comment on CASSANDRA-6438 at 1/9/14 6:21 PM:
---------------------------------------------------------------

I'm running into a snag trying to work with the new functionality.

My dtests now error out when I try to create a type without an active keyspace, 
which seems reasonable to me (unless we want to allow the creation of user 
types outside any keyspace).

The problem I'm running into is I become disconnected from the node when trying 
to create a user type within a keyspace:

Here's a setup that should replicate:
{noformat}
ccm create test_cluster
ccm populate -n 2
ccm start
ccm node1 cqlsh

cqlsh> create keyspace user_type_renaming with replication = 
{'class':'SimpleStrategy', 'replication_factor':2} ;
cqlsh> use user_type_renaming;
cqlsh:user_type_renaming> create type simple_type (user_number int);
TSocket read 0 bytes

Here's the exception found in the node's log:

ERROR [Thrift:1] 2014-01-09 11:14:57,996 CustomTThreadPoolServer.java:212 - 
Error occurred during processing of message.
java.lang.ClassCastException: java.nio.HeapByteBuffer cannot be cast to 
java.lang.String
        at 
org.apache.cassandra.serializers.AbstractTextSerializer.serialize(AbstractTextSerializer.java:26)
 ~[main/:na]
        at 
org.apache.cassandra.db.marshal.AbstractType.decompose(AbstractType.java:71) 
~[main/:na]
        at org.apache.cassandra.db.CFRowAdder.add(CFRowAdder.java:106) 
~[main/:na]
        at org.apache.cassandra.db.CFRowAdder.addListEntry(CFRowAdder.java:87) 
~[main/:na]
        at org.apache.cassandra.config.UTMetaData.toSchema(UTMetaData.java:104) 
~[main/:na]
        at org.apache.cassandra.config.UTMetaData.toSchema(UTMetaData.java:90) 
~[main/:na]
        at 
org.apache.cassandra.service.MigrationManager.announceNewType(MigrationManager.java:238)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.statements.CreateTypeStatement.announceMigration(CreateTypeStatement.java:128)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:71)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:194)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:228) 
~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:218) 
~[main/:na]
        at 
org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1966)
 ~[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_45]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
[na:1.7.0_45]
        at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
{noformat}


was (Author: rhatch):
I'm running into a snag traying to work with the new functionality.

My dtests now error out when I try to create a type without an active keyspace, 
which seems reasonable to me (unless we want to allow the creation of user 
types outside any keyspace).

The problem I'm running into is I become disconnected from the node when trying 
to create a user type within a keyspace:

Here's a setup that should replicate:
{noformat}
ccm create test_cluster
ccm populate -n 2
ccm start
ccm node1 cqlsh

cqlsh> create keyspace user_type_renaming with replication = 
{'class':'SimpleStrategy', 'replication_factor':2} ;
cqlsh> use user_type_renaming;
cqlsh:user_type_renaming> create type simple_type (user_number int);
TSocket read 0 bytes

Here's the exception found in the node's log:

ERROR [Thrift:1] 2014-01-09 11:14:57,996 CustomTThreadPoolServer.java:212 - 
Error occurred during processing of message.
java.lang.ClassCastException: java.nio.HeapByteBuffer cannot be cast to 
java.lang.String
        at 
org.apache.cassandra.serializers.AbstractTextSerializer.serialize(AbstractTextSerializer.java:26)
 ~[main/:na]
        at 
org.apache.cassandra.db.marshal.AbstractType.decompose(AbstractType.java:71) 
~[main/:na]
        at org.apache.cassandra.db.CFRowAdder.add(CFRowAdder.java:106) 
~[main/:na]
        at org.apache.cassandra.db.CFRowAdder.addListEntry(CFRowAdder.java:87) 
~[main/:na]
        at org.apache.cassandra.config.UTMetaData.toSchema(UTMetaData.java:104) 
~[main/:na]
        at org.apache.cassandra.config.UTMetaData.toSchema(UTMetaData.java:90) 
~[main/:na]
        at 
org.apache.cassandra.service.MigrationManager.announceNewType(MigrationManager.java:238)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.statements.CreateTypeStatement.announceMigration(CreateTypeStatement.java:128)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:71)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:194)
 ~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:228) 
~[main/:na]
        at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:218) 
~[main/:na]
        at 
org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1966)
 ~[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_45]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
[na:1.7.0_45]
        at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
{noformat}

> Make user types keyspace scoped
> -------------------------------
>
>                 Key: CASSANDRA-6438
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6438
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 2.1
>
>         Attachments: 6438.txt
>
>
> Currently, user types are declared at the top level. I wonder however if we 
> might not want to make them scoped to a given keyspace. It was not done in 
> the initial patch for simplicity and because I was not sure of the advantages 
> of doing so. However, if we ever want to use user types in system tables, 
> having them scoped by keyspace means we won't have to care about the new type 
> conflicting with another existing type.
> Besides, having user types be part of a keyspace would allow for slightly 
> more fine grained permissions on them. 



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

Reply via email to