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

Alex Petrov commented on CASSANDRA-16048:
-----------------------------------------

[~jwest] sure, here's the repro:

Setup:
{code:java}
cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 1};
cqlsh> CREATE TABLE test.test_comact_storage (pk int, ck int, v1 int, primary 
key (pk, ck)) WITH COMPACT STORAGE;
cqlsh> CREATE TABLE test.test_not_comact_storage (pk int, ck int, v1 int, 
primary key (pk, ck));
{code}
Populate both tables with a single row:
{code:java}
cqlsh> INSERT INTO test.test_comact_storage (pk, ck, v1) VALUES (1,1,1);
cqlsh> INSERT INTO test.test_not_comact_storage (pk, ck, v1) VALUES (1,1,1);
cqlsh> select * from test.test_comact_storage;

pk | ck | v1
----+----+----
1 |  1 |  1

(1 rows)
cqlsh> select * from test.test_not_comact_storage;

pk | ck | v1
----+----+----
1 |  1 |  1

(1 rows)
{code}
Both tables return the same result (as their schemas are visibly identical). 
Now, try deleting v1 value from the row:
{code:java}
cqlsh> DELETE v1 FROM test.test_comact_storage WHERE pk = 1 AND ck = 1;
cqlsh> DELETE v1 FROM test.test_not_comact_storage WHERE pk = 1 AND ck = 1;
cqlsh> select * from test.test_comact_storage;

pk | ck | v1
----+----+----

(0 rows)
cqlsh> select * from test.test_not_comact_storage;

pk | ck | v1
----+----+------
1 |  1 | null

(1 rows)
{code}
As you see, in a compact storage table we have removed an entire row, but in a 
regular table we, as you'd expect, have removed just {{v1}}

Now, drop comact storage from the table:
{code:java}
cqlsh> alter table test.test_comact_storage DROP COMPACT STORAGE;
cqlsh> select * from test.test_comact_storage;

pk | ck | v1
----+----+----

(0 rows)
{code}
Row is still not visible, but that's ok, otherwise it'd probably be worse.

However, starting now, behaviour of {{DELETE v1}} is going to change on this 
table:
{code:java}
cqlsh> INSERT INTO test.test_comact_storage (pk, ck, v1) VALUES (2,2,2);
cqlsh> DELETE v1 FROM test.test_comact_storage WHERE pk = 2 AND ck = 2;
cqlsh> select * from test.test_comact_storage;

pk | ck | v1
----+----+------
2 |  2 | null
{code}
Previously, we would see an entire row hidden. Now we won't.

I'm not saying this is something huge, maybe there's even no use-case for 
something like this, but I thought it's important to point this out.

> Safely Ignore Compact Storage Tables Where Users Have Defined Clustering and 
> Value Columns
> ------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-16048
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16048
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Legacy/CQL
>            Reporter: Jordan West
>            Assignee: Jordan West
>            Priority: Normal
>             Fix For: 4.0-beta
>
>
> Some compact storage tables, specifically those where the user has defined 
> both at least one clustering and the value column, can be safely handled in 
> 4.0 because besides the DENSE flag they are not materially different post 3.0 
> and there is no visible change to the user facing schema after dropping 
> compact storage. We can detect this case and allow these tables to silently 
> drop the DENSE flag while still throwing a start-up error for COMPACT STORAGE 
> tables that don’t meet the criteria. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to