[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-14 Thread Aleksey Yeschenko (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14097696#comment-14097696
 ] 

Aleksey Yeschenko commented on CASSANDRA-7744:
--

Oh well. I guess we still have an issue with Thrift, but it's older than 7744, 
so should be handled separately.

The patch LGTM, with tiny nits:
- should probably add isDense to CFM#equals() and CFM#toString()
- method does it's best should read method does its best

 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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)


[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-13 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14095242#comment-14095242
 ] 

Robert Stupp commented on CASSANDRA-7744:
-

[~iamaleksey] thanks for the explanation. IMO since it seems that it never 
worked before, I'd prefer the first option (reject such updates).

 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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)


[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-12 Thread Aleksey Yeschenko (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094576#comment-14094576
 ] 

Aleksey Yeschenko commented on CASSANDRA-7744:
--

Haven't dug into it, but the patch breaks CliTest, in a legit way:

{code}
 [junit] Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
 [junit]at java.util.ArrayList.rangeCheck(ArrayList.java:635)
 [junit]at java.util.ArrayList.set(ArrayList.java:426)
 [junit]at 
org.apache.cassandra.config.CFMetaData.rebuildCQL3Metadata(CFMetaData.java:1981)
 [junit]at 
org.apache.cassandra.config.CFMetaData.rebuild(CFMetaData.java:1947)
 [junit]at 
org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:1117)
 [junit]at 
org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:1046)
 [junit]at 
org.apache.cassandra.db.DefsTables.updateColumnFamily(DefsTables.java:377)
 [junit]at 
org.apache.cassandra.db.DefsTables.mergeColumnFamilies(DefsTables.java:318)
 [junit]at 
org.apache.cassandra.db.DefsTables.mergeSchema(DefsTables.java:183)
{code}

 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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)


[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-12 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094623#comment-14094623
 ] 

Robert Stupp commented on CASSANDRA-7744:
-

[~iamaleksey] not sure if it's correct:
* comment out CFMetaData:1961: {{//if (isDense == null)}}
* change L1981 to {noformat}
int ckIdx = def.componentIndex == null ? 0 : 
def.componentIndex;
if (ckIdx  ckCols.size())
ckCols.set(ckIdx, def);
else
ckCols.add(def);
{noformat}

CliTest test runs through all tests afterwards.

 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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)


[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-12 Thread Aleksey Yeschenko (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094687#comment-14094687
 ] 

Aleksey Yeschenko commented on CASSANDRA-7744:
--

[~snazy] the goal isn't to make the test pass - it's to fix the underlying 
problem.

 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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)


[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-12 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14094714#comment-14094714
 ] 

Robert Stupp commented on CASSANDRA-7744:
-

Yes - the patch introduced the isDense field caching. It's set directly by 
CreateTableStatement. And it's set implicitly in rebuildCQL3Metadata - but only 
once - a second call to rebuildCQL3Metadata (or the first after 
CreateTableStatement) would not change the dense-setting and cause the failure.

 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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)


[jira] [Commented] (CASSANDRA-7744) Dropping the last collection column turns CompoundSparseCellNameType$WithCollection into CompoundDenseCellNameType

2014-08-12 Thread Aleksey Yeschenko (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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 mapint,int);
 cqlsh:test alter table test drop col;
 cqlsh:test alter table test add col listint;
 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)