cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Stupp (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-7301) UDT - alter type add field not propagated
Date Sun, 25 May 2014 16:32:01 GMT

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

Robert Stupp commented on CASSANDRA-7301:
-----------------------------------------

I didn't test, but I guess that updates to columns using such an altered type will not work,
because the column value validation will fail.

> UDT - alter type add field not propagated
> -----------------------------------------
>
>                 Key: CASSANDRA-7301
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7301
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Robert Stupp
>
> The {{system.schema_columns}} table contains the "denormalized" description of the user
type its {{validator}} column.
> But if the type is changed after a column using that type has been created, the column's
{{validator}} column still contains the old (and now incorrect) description of the user type.
> This gets even more complicated if user types are embedded in other user types...
> {code}
> cqlsh:demo> CREATE KEYSPACE demo WITH replication = {'class':'SimpleStrategy','replication_factor':1};
> cqlsh:demo> CREATE TYPE demo.address ( street varchar, city varchar, country varchar);
> cqlsh:demo> CREATE TABLE demo.user ( name varchar primary key, main_address address);
> cqlsh:demo> select * from system.schema_columns where keyspace_name='demo';
>  keyspace_name | columnfamily_name | column_name  | component_index | index_name | index_options
| index_type | type          | validator
> ---------------+-------------------+--------------+-----------------+------------+---------------+------------+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>           demo |              user | main_address |               0 |       null |  
       null |       null |       regular | org.apache.cassandra.db.marshal.UserType(demo,61646472657373,737472656574:org.apache.cassandra.db.marshal.UTF8Type,63697479:org.apache.cassandra.db.marshal.UTF8Type,636f756e747279:org.apache.cassandra.db.marshal.UTF8Type)
>           demo |              user |         name |            null |       null |  
       null |       null | partition_key |                                               
                                                                                         
                                            org.apache.cassandra.db.marshal.UTF8Type
> (2 rows)
> cqlsh:demo> alter type demo.address add zip_code text;
> <ErrorMessage code=0000 [Server error] message="java.lang.RuntimeException: java.util.concurrent.ExecutionException:
java.lang.AssertionError">
> cqlsh:demo> select * from system.schema_columns where keyspace_name='demo';
>  keyspace_name | columnfamily_name | column_name  | component_index | index_name | index_options
| index_type | type          | validator
> ---------------+-------------------+--------------+-----------------+------------+---------------+------------+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>           demo |              user | main_address |               0 |       null |  
       null |       null |       regular | org.apache.cassandra.db.marshal.UserType(demo,61646472657373,737472656574:org.apache.cassandra.db.marshal.UTF8Type,63697479:org.apache.cassandra.db.marshal.UTF8Type,636f756e747279:org.apache.cassandra.db.marshal.UTF8Type)
>           demo |              user |         name |            null |       null |  
       null |       null | partition_key |                                               
                                                                                         
                                            org.apache.cassandra.db.marshal.UTF8Type
> (2 rows)
> cqlsh:demo> select * from system.schema_usertypes where keyspace_name='demo';
>  keyspace_name | type_name | field_names                               | field_types
> ---------------+-----------+-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>           demo |   address | ['street', 'city', 'country', 'zip_code'] | ['org.apache.cassandra.db.marshal.UTF8Type',
'org.apache.cassandra.db.marshal.UTF8Type', 'org.apache.cassandra.db.marshal.UTF8Type', 'org.apache.cassandra.db.marshal.UTF8Type']
> (1 rows)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message