[ https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14094948#comment-14094948 ]
Aleksey Yeschenko commented on CASSANDRA-7744: ---------------------------------------------- Well, no, it has nothing to do with CreateTableStatement, being CliTest, and everything to do with Thrift. The following sequence is enough to reproduce: {code} create column family test with comparator=UTF8Type and column_metadata=[{ column_name:test, validation_class:BytesType}]; update column family test with comparator=UTF8Type and column_metadata=[]; {code} The CF remains sparse after the update, but the automatically added clustering column is now OOB because of {code} int nbCkCols = isDense ? comparator.componentsCount() : comparator.componentsCount() - (hasCollection() ? 2 : 1); {code} Problem is of course that CFMetaData#fromThriftForUpdate() called CFMetaData#rebuild() which didn't know yet at that stage about the old CF being sparse, so it auto-created a clustering column thinking it was dense. So it's the inverse, really - the bug caused by the value not persisting. The table turns from sparse to dense in the end. Several ways to deal with this - from rejecting updates like this (we don't allow removing columns from COMPACT STORAGE via CQL3, this would be consistent), to making sure that sparseness/denseness always persists through updates via Thrift. > Dropping the last collection column turns > CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType > ------------------------------------------------------------------------------------------------------------------ > > Key: CASSANDRA-7744 > URL: https://issues.apache.org/jira/browse/CASSANDRA-7744 > Project: Cassandra > Issue Type: Bug > Reporter: Aleksey Yeschenko > Assignee: Sylvain Lebresne > Fix For: 2.0.10, 2.1.0 > > Attachments: 7744.txt > > > Dropping the last collection column turns > CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType > To reproduce > {code} > cqlsh:test> create table test (id int primary key, col map<int,int>); > cqlsh:test> alter table test drop col; > cqlsh:test> alter table test add col list<int>; > code=2200 [Invalid query] message="Cannot add new column to a COMPACT STORAGE > table" > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)