[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13922211#comment-13922211 ] Sylvain Lebresne commented on CASSANDRA-6623: - That's correct, pushed that fix, thanks (the worst part is that there is a dtest but it was currently skipped, so activated it too). > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Assignee: Sylvain Lebresne >Priority: Minor > Fix For: 2.0.6 > > Attachments: > 0001-Fix-for-expiring-columns-used-in-cas-conditions.patch, 6623.txt > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13922046#comment-13922046 ] Paul Kendall commented on CASSANDRA-6623: - This problem is not fixed. I am trying to exactly as the steps as in comment #2 above and get exactly the same problems using the trunk version from git. > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Assignee: Sylvain Lebresne >Priority: Minor > Fix For: 2.0.6 > > Attachments: 6623.txt > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13892577#comment-13892577 ] Aleksey Yeschenko commented on CASSANDRA-6623: -- LGTM Nits: - I'd rather see {code}if (!(c != null && c.isLive(now) && c.value().equals(e.value({code} rewritten as {code}if (c == null || c.isMarkedForDelete(now) || !c.value().equals(e.value())){code} in ThriftCASConditions (as it is more or less in ColumnsConditions, apparently) - hasLiveColumns() in ColumnsCondition is dead code - ByteBufferUtil in ModificationStatement; ColumnNameBuilder, NamesQueryFilter, and SliceQueryFilter in SP are now unused imports > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Assignee: Sylvain Lebresne >Priority: Minor > Fix For: 2.0.6 > > Attachments: 6623.txt > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13885136#comment-13885136 ] Csaba Seres commented on CASSANDRA-6623: Dear Sylvain Lebresne, Sorry for the late reply but we had much work to finish. Thank you for your respond. We wanted to use lightweight transaction as a semaphore (to lock a row or a Column Family). We would have used the TTL to guarantee a time limit for processes. As the null problem is only in CQL3 table, we use Compact Storage table for timed semaphores. Best Regards, Csaba Seres > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Priority: Minor > Fix For: 2.0.4 > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13882875#comment-13882875 ] Sylvain Lebresne commented on CASSANDRA-6623: - Thanks Csaba. So this is kind of due to CASSANDRA-5619 patch, with a soupçon of the problem from CASSANDRA-5762 thrown in. When we generate conditions on a row internally, we currently include the row marker in the 'expected' CF. The reason is that for CASSANDRA-5619, we wanted to distinguish the cases of CAS failure because the row doesn't exist, from CAS failure because all columns on which we have conditions are null (but the row exists). So including the row marker in 'expected', makes us query the row marker, which in turns allows to say if the row does exists or not on CAS failure. But this also means that 'UPDATE IF' checks for the row existence. Which doesn't really matter, unless you have only 'null' conditions. Namely, doing {noformat} CREATE TABLE test (k int PRIMARY KEY, v int) UPDATE test SET v = 1 WHERE k = 0 IF v = null {noformat} the last update won't work, because the row doesn't exist prior to the update. And I think this is actually the first question to ask here: do we want that update not to work? I could see arguments for either side tbh. On the one side, since 'null' means the column doesn't exist, if the row don't exist then the column doesn't either and in that sense the update should work. On the other side, making it not work is somewhat more expressive since it allow to check for 'row exists but has null value' separately of 'row doesn't exists' (which you can already check with an 'INSERT IF NOT EXISTS'). Also, this reinforce the notion that with conditions, UPDATE work really more like a SQL UPDATE. So anyway, the problem Csaba is having here is a bit different. Namely, it's due to the fact that TTL ends up removing the row marker, even if the TTL was only applied to one of the columns and is not a proper marker of row existence. The result is that the row marker expires in Casba example, but since the CAS expects it to be there, it fails (and this, even though the row actually does still exist). I think the solution here is basically the same than in CASSANDRA-5762, we should query the full CQL row as soon as we have a condition on it to be able to reliably say if the row exists or not. But while we're at it, it's worth deciding if we want to preserve the current 'UPDATE IF always checks for row existence' behavior or not. > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Priority: Minor > Fix For: 2.0.4 > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13882828#comment-13882828 ] Csaba Seres commented on CASSANDRA-6623: Dear Sylvain Lebresne, I created a table without COMPACT STORAGE directive: cqlsh> CREATE TABLE astyanaxks.cf2 (name varchar PRIMARY KEY, lock varchar, something varchar); Then inserted a row: cqlsh> INSERT INTO astyanaxks.cf2 (name, lock , something ) VALUES ( 'name1', 'lock1', 'som1'); Updated the lock column with a new TTL value: cqlsh> UPDATE astyanaxks.cf2 USING TTL 10 SET lock='lock2' WHERE name='name1'; cqlsh> SELECT * FROM astyanaxks.cf2; name | lock | something ---+---+--- name1 | lock2 | som1 (1 rows) After 10 seconds: cqlsh> SELECT * FROM astyanaxks.cf2; name | lock | something ---+--+--- name1 | null | som1 (1 rows) Then I wanted to update the row if lock is null: cqlsh> UPDATE astyanaxks.cf2 USING TTL 10 SET lock='lock2' WHERE name='name1' IF lock=null; [applied] --- False It was unsuccessful. cqlsh> SELECT * FROM astyanaxks.cf2; name | lock | something ---+--+--- name1 | null | som1 (1 rows) cqlsh> On the other hand, if the null value is set by an update, then IF clause works. On the same Column Family: cqlsh> UPDATE astyanaxks.cf2 SET lock=null WHERE name='name1'; cqlsh> UPDATE astyanaxks.cf2 USING TTL 10 SET lock='lock2' WHERE name='name1' IF lock=null; [applied] --- True cqlsh> SELECT * FROM astyanaxks.cf2; name | lock | something ---+---+--- name1 | lock2 | som1 Now lock column is set. Best Regards, Csaba Seres > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Priority: Minor > Fix For: 2.0.4 > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (CASSANDRA-6623) Null in a cell caused by expired TTL does not work with IF clause (in CQL3)
[ https://issues.apache.org/jira/browse/CASSANDRA-6623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13882783#comment-13882783 ] Sylvain Lebresne commented on CASSANDRA-6623: - Can you provide a simple reproduction test case? (I'm not contesting there is a problem, just want to make sure what you are running into exactly first) > Null in a cell caused by expired TTL does not work with IF clause (in CQL3) > --- > > Key: CASSANDRA-6623 > URL: https://issues.apache.org/jira/browse/CASSANDRA-6623 > Project: Cassandra > Issue Type: Bug > Components: Tests > Environment: One cluster with two nodes on a Linux and a Windows > system. cqlsh 4.1.0 | Cassandra 2.0.4 | CQL spec 3.1.1 | Thrift protocol > 19.39.0. CQL3 Column Family >Reporter: Csaba Seres >Priority: Minor > Fix For: 2.0.4 > > > IF onecell=null clause does not work if the onecell has got its null value > from an expired TTL. If onecell is updated with null value (UPDATE) then IF > onecell=null works fine. > This bug is not present when you create a table with COMPACT STORAGE > directive. -- This message was sent by Atlassian JIRA (v6.1.5#6160)