[jira] [Commented] (CASSANDRA-13917) COMPACT STORAGE inserts on tables without clusterings accept hidden column1 and value columns

2018-11-23 Thread Alex Petrov (JIRA)


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

Alex Petrov commented on CASSANDRA-13917:
-

After looking a bit more, I do not think the issue is fully fixed: 

{code}
# Still throws 'Range deletions are not supported for specific columns'
DELETE value FROM %s WHERE a = 1

# Still throws 'Invalid identifier column1 for deletion (should not be a 
PRIMARY KEY part)'
DELETE column1 FROM %s WHERE a = 1

# Still works:
DELETE FROM %s WHERE a = 1 and column1 = 'b'

# Still works:
SELECT value, column1 FROM %s
{code}

You're right it's not supercolumn cf, so we have only [compact 
value|https://github.com/apache/cassandra/blob/cassandra-3.11/src/java/org/apache/cassandra/config/CFMetaData.java#L124]
 that we can use.

After thinking a bit more, I'd try and explore more places where 
{{getColumnDefinition}} is used in order to understand better the surface of 
the problem and maybe even try looking 
[here|https://github.com/apache/cassandra/blob/cassandra-3.11/test/unit/org/apache/cassandra/cql3/validation/operations/DropCompactStorageThriftTest.java]
 to learn more about compact storage. 

If you have any questions about compact storage, I'm happy to help either on 
IRC or here.

> COMPACT STORAGE inserts on tables without clusterings accept hidden column1 
> and value columns
> -
>
> Key: CASSANDRA-13917
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13917
> Project: Cassandra
>  Issue Type: Bug
>  Components: Core
>Reporter: Alex Petrov
>Assignee: Aleksandr Sorokoumov
>Priority: Minor
>  Labels: lhf
> Fix For: 3.0.x, 3.11.x
>
> Attachments: 13917-3.0.png, 13917-3.11.png
>
>
> Test for the issue:
> {code}
> @Test
> public void testCompactStorage() throws Throwable
> {
> createTable("CREATE TABLE %s (a int PRIMARY KEY, b int, c int) WITH 
> COMPACT STORAGE");
> assertInvalid("INSERT INTO %s (a, b, c, column1) VALUES (?, ?, ?, 
> ?)", 1, 1, 1, ByteBufferUtil.bytes('a'));
> // This one fails with Some clustering keys are missing: column1, 
> which is still wrong
> assertInvalid("INSERT INTO %s (a, b, c, value) VALUES (?, ?, ?, ?)", 
> 1, 1, 1, ByteBufferUtil.bytes('a'));   
> assertInvalid("INSERT INTO %s (a, b, c, column1, value) VALUES (?, ?, 
> ?, ?, ?)", 1, 1, 1, ByteBufferUtil.bytes('a'), ByteBufferUtil.bytes('b'));
> assertEmpty(execute("SELECT * FROM %s"));
> }
> {code}
> Gladly, these writes are no-op, even though they succeed.
> {{value}} and {{column1}} should be completely hidden. Fixing this one should 
> be as easy as just adding validations.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CASSANDRA-13917) COMPACT STORAGE inserts on tables without clusterings accept hidden column1 and value columns

2018-11-22 Thread Aleksandr Sorokoumov (JIRA)


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

Aleksandr Sorokoumov commented on CASSANDRA-13917:
--

Thanks for feedback! I fixed indentation in tests, changed the check to report 
all unmatching columns at once and rebased both branches.

I did not use {{superCfKeyColumn}} and {{superCfValueColumn}} because they are 
null in the test case.

Created new branches:
* https://github.com/Ge/cassandra/tree/13917-3.0
* https://github.com/Ge/cassandra/tree/13917-3.11

CI results:
* [13917-3.0 | 
https://issues.apache.org/jira/secure/attachment/12949215/13917-3.0.png]
* [13917-3.11 | 
https://issues.apache.org/jira/secure/attachment/12949214/13917-3.11.png]


> COMPACT STORAGE inserts on tables without clusterings accept hidden column1 
> and value columns
> -
>
> Key: CASSANDRA-13917
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13917
> Project: Cassandra
>  Issue Type: Bug
>  Components: Core
>Reporter: Alex Petrov
>Assignee: Aleksandr Sorokoumov
>Priority: Minor
>  Labels: lhf
> Fix For: 3.0.x, 3.11.x
>
> Attachments: 13917-3.0.png, 13917-3.11.png
>
>
> Test for the issue:
> {code}
> @Test
> public void testCompactStorage() throws Throwable
> {
> createTable("CREATE TABLE %s (a int PRIMARY KEY, b int, c int) WITH 
> COMPACT STORAGE");
> assertInvalid("INSERT INTO %s (a, b, c, column1) VALUES (?, ?, ?, 
> ?)", 1, 1, 1, ByteBufferUtil.bytes('a'));
> // This one fails with Some clustering keys are missing: column1, 
> which is still wrong
> assertInvalid("INSERT INTO %s (a, b, c, value) VALUES (?, ?, ?, ?)", 
> 1, 1, 1, ByteBufferUtil.bytes('a'));   
> assertInvalid("INSERT INTO %s (a, b, c, column1, value) VALUES (?, ?, 
> ?, ?, ?)", 1, 1, 1, ByteBufferUtil.bytes('a'), ByteBufferUtil.bytes('b'));
> assertEmpty(execute("SELECT * FROM %s"));
> }
> {code}
> Gladly, these writes are no-op, even though they succeed.
> {{value}} and {{column1}} should be completely hidden. Fixing this one should 
> be as easy as just adding validations.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CASSANDRA-13917) COMPACT STORAGE inserts on tables without clusterings accept hidden column1 and value columns

2018-11-12 Thread Alex Petrov (JIRA)


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

Alex Petrov commented on CASSANDRA-13917:
-

The patch looks good, modulo indentation in tests. Also, I would list all 
unmatching columns in the error message instead of just a single in case 
someone would try to repair query by repairing one column after another.

Another thing, to my best memory, we have actual definitions listed 
[here|https://github.com/apache/cassandra/blob/cassandra-3.11/src/java/org/apache/cassandra/config/CFMetaData.java#L138],
 which we probably should use. I realise that this does not change much 
semantically but still might be less error-prone.

> COMPACT STORAGE inserts on tables without clusterings accept hidden column1 
> and value columns
> -
>
> Key: CASSANDRA-13917
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13917
> Project: Cassandra
>  Issue Type: Bug
>  Components: Core
>Reporter: Alex Petrov
>Assignee: Aleksandr Sorokoumov
>Priority: Minor
>  Labels: lhf
> Fix For: 3.0.x, 3.11.x
>
>
> Test for the issue:
> {code}
> @Test
> public void testCompactStorage() throws Throwable
> {
> createTable("CREATE TABLE %s (a int PRIMARY KEY, b int, c int) WITH 
> COMPACT STORAGE");
> assertInvalid("INSERT INTO %s (a, b, c, column1) VALUES (?, ?, ?, 
> ?)", 1, 1, 1, ByteBufferUtil.bytes('a'));
> // This one fails with Some clustering keys are missing: column1, 
> which is still wrong
> assertInvalid("INSERT INTO %s (a, b, c, value) VALUES (?, ?, ?, ?)", 
> 1, 1, 1, ByteBufferUtil.bytes('a'));   
> assertInvalid("INSERT INTO %s (a, b, c, column1, value) VALUES (?, ?, 
> ?, ?, ?)", 1, 1, 1, ByteBufferUtil.bytes('a'), ByteBufferUtil.bytes('b'));
> assertEmpty(execute("SELECT * FROM %s"));
> }
> {code}
> Gladly, these writes are no-op, even though they succeed.
> {{value}} and {{column1}} should be completely hidden. Fixing this one should 
> be as easy as just adding validations.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (CASSANDRA-13917) COMPACT STORAGE inserts on tables without clusterings accept hidden column1 and value columns

2017-11-30 Thread Jeff Jirsa (JIRA)

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

Jeff Jirsa commented on CASSANDRA-13917:


[~ifesdjeen] are you able to review this as the reporter?

> COMPACT STORAGE inserts on tables without clusterings accept hidden column1 
> and value columns
> -
>
> Key: CASSANDRA-13917
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13917
> Project: Cassandra
>  Issue Type: Bug
>Reporter: Alex Petrov
>Assignee: Aleksandr Sorokoumov
>Priority: Minor
>  Labels: lhf
> Fix For: 3.0.x, 3.11.x
>
>
> Test for the issue:
> {code}
> @Test
> public void testCompactStorage() throws Throwable
> {
> createTable("CREATE TABLE %s (a int PRIMARY KEY, b int, c int) WITH 
> COMPACT STORAGE");
> assertInvalid("INSERT INTO %s (a, b, c, column1) VALUES (?, ?, ?, 
> ?)", 1, 1, 1, ByteBufferUtil.bytes('a'));
> // This one fails with Some clustering keys are missing: column1, 
> which is still wrong
> assertInvalid("INSERT INTO %s (a, b, c, value) VALUES (?, ?, ?, ?)", 
> 1, 1, 1, ByteBufferUtil.bytes('a'));   
> assertInvalid("INSERT INTO %s (a, b, c, column1, value) VALUES (?, ?, 
> ?, ?, ?)", 1, 1, 1, ByteBufferUtil.bytes('a'), ByteBufferUtil.bytes('b'));
> assertEmpty(execute("SELECT * FROM %s"));
> }
> {code}
> Gladly, these writes are no-op, even though they succeed.
> {{value}} and {{column1}} should be completely hidden. Fixing this one should 
> be as easy as just adding validations.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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



[jira] [Commented] (CASSANDRA-13917) COMPACT STORAGE inserts on tables without clusterings accept hidden column1 and value columns

2017-10-13 Thread Aleksandr Sorokoumov (JIRA)

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

Aleksandr Sorokoumov commented on CASSANDRA-13917:
--

If the table is created with COMPACT STORAGE and a single primary key, e.g.

{noformat}
cqlsh:k> CREATE TABLE t1 (a int PRIMARY KEY, b int, c int) WITH COMPACT STORAGE;
{noformat}

We get the behavior from the tests:

{noformat}
cqlsh:k> INSERT INTO t1 (a,b,c,column1) VALUES (1,1,1,'a');
cqlsh:k> select * from t1;

 a | b | c
---+---+---

(0 rows)
{noformat}

Corresponding CFMMetaData and the column definition kinds during the {{INSERT}}:
{noformat}
cfm:
isCompactTable() => true
isStaticCompactTable() => true

Column definitions:
a.kind=PARTITION_KEY
b.kind=STATIC
c.kind=STATIC
column1.kind=CLUSTERING
value.kind=REGULAR
{noformat}

Also, if the table contains a column with a name {{column1}}, the hidden column 
will be called {{column2}}:

{noformat}
cqlsh:k> CREATE TABLE t2 (a int PRIMARY KEY, b int, c int, column1 text) WITH 
COMPACT STORAGE;
cqlsh:k> INSERT INTO t2 (a,b,c,column1, column2, value) VALUES 
(1,1,1,'a','a',0xbb);
cqlsh:k> select * from t2;

 a | b | c | column1
---+---+---+-

(0 rows)
{noformat}

If the table is created with COMPACT STORAGE and a compound primary key, it 
works as expected:

{noformat}
cqlsh:k> CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a, b)) WITH COMPACT 
STORAGE;
cqlsh:k> INSERT INTO t3 (a,b,c,column1) VALUES (1,1,1,'a');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Undefined 
column name column1"
cqlsh:k> INSERT INTO t3 (a,b,c,column1,value) VALUES (1,1,1,'a',0xff);
InvalidRequest: Error from server: code=2200 [Invalid query] message="Undefined 
column name column1"
cqlsh:k> INSERT INTO t3 (a,b,c,value) VALUES (1,1,1,0xff);
InvalidRequest: Error from server: code=2200 [Invalid query] message="Undefined 
column name value"
{noformat}

Corresponding CFMMetaData during the {{INSERT}}:

{noformat}
cfm.isCompactTable() => true
cfm.isStaticCompactTable() => false
{noformat}

h4. Solution

In {{UpdateStatement.prepareInternal}} when the CFM is {{StaticCompactTable}} 
check that the columns to be updated are not {{CLUSTERING}} or {{REGULAR}}. if 
this is the case - "hide" the columns by returning the error "Undefined column 
name".

Branches:

* [3.0.15|https://github.com/Ge/cassandra/tree/13917-3.0.15]
* [3.11.1|https://github.com/Ge/cassandra/tree/13917-3.11.1]

> COMPACT STORAGE inserts on tables without clusterings accept hidden column1 
> and value columns
> -
>
> Key: CASSANDRA-13917
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13917
> Project: Cassandra
>  Issue Type: Bug
>Reporter: Alex Petrov
>Assignee: Aleksandr Sorokoumov
>Priority: Minor
>  Labels: lhf
>
> Test for the issue:
> {code}
> @Test
> public void testCompactStorage() throws Throwable
> {
> createTable("CREATE TABLE %s (a int PRIMARY KEY, b int, c int) WITH 
> COMPACT STORAGE");
> assertInvalid("INSERT INTO %s (a, b, c, column1) VALUES (?, ?, ?, 
> ?)", 1, 1, 1, ByteBufferUtil.bytes('a'));
> // This one fails with Some clustering keys are missing: column1, 
> which is still wrong
> assertInvalid("INSERT INTO %s (a, b, c, value) VALUES (?, ?, ?, ?)", 
> 1, 1, 1, ByteBufferUtil.bytes('a'));   
> assertInvalid("INSERT INTO %s (a, b, c, column1, value) VALUES (?, ?, 
> ?, ?, ?)", 1, 1, 1, ByteBufferUtil.bytes('a'), ByteBufferUtil.bytes('b'));
> assertEmpty(execute("SELECT * FROM %s"));
> }
> {code}
> Gladly, these writes are no-op, even though they succeed.
> {{value}} and {{column1}} should be completely hidden. Fixing this one should 
> be as easy as just adding validations.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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