[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13657471#comment-13657471 ] Jonathan Ellis commented on CASSANDRA-5443: --- The tracing I see suggests that this is actually executing StorageProxy.mutate instead of SP.cas: {noformat} cqlsh:foo update bar set j=1 where i=1 if not exists; activity | timestamp| source| source_elapsed ---+--+---+ execute_cql3_query | 15:24:50,122 | 127.0.0.1 | 0 Parsing statement | 15:24:50,122 | 127.0.0.1 | 68 Peparing statement | 15:24:50,123 | 127.0.0.1 |482 Determining replicas for mutation | 15:24:50,123 | 127.0.0.1 |762 Acquiring switchLock read lock | 15:24:50,124 | 127.0.0.1 | 1790 Appending to commitlog | 15:24:50,124 | 127.0.0.1 | 1815 Adding to bar memtable | 15:24:50,124 | 127.0.0.1 | 1871 Request complete | 15:24:50,124 | 127.0.0.1 | 2246 {noformat} it's not just the IF EXISTS syntax: {noformat} cqlsh:foo update bar set j=2 where i=1 if j=1; activity | timestamp| source| source_elapsed ---+--+---+ execute_cql3_query | 15:25:32,657 | 127.0.0.1 | 0 Parsing statement | 15:25:32,657 | 127.0.0.1 | 47 Peparing statement | 15:25:32,657 | 127.0.0.1 |306 Determining replicas for mutation | 15:25:32,657 | 127.0.0.1 |457 Acquiring switchLock read lock | 15:25:32,658 | 127.0.0.1 | 1082 Appending to commitlog | 15:25:32,658 | 127.0.0.1 | 1106 Adding to bar memtable | 15:25:32,658 | 127.0.0.1 | 1163 Request complete | 15:25:32,658 | 127.0.0.1 | 1440 {noformat} Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt, 0005-add-UPDATE-.-IF-NOT-EXISTS-syntax.txt, 0006-Make-EXISTS-a-reserverd-keyword.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13657636#comment-13657636 ] Aleksey Yeschenko commented on CASSANDRA-5443: -- (we accidentally broke it in https://github.com/apache/cassandra/commit/2f3f620e while fixing counter updates) Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt, 0005-add-UPDATE-.-IF-NOT-EXISTS-syntax.txt, 0006-Make-EXISTS-a-reserverd-keyword.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13645346#comment-13645346 ] Sylvain Lebresne commented on CASSANDRA-5443: - bq. K_EXISTS has not been added to unreserved keywords Right, good catch, adding a patch to make that happen. I'm also not sure about {{IF}} and {{NOT}}, it will weird to have them unreserved and I can't imagine someone in his right mind using them as column name (I note that for the same reasoning, {{NULL}} has been added as a reserved keyword recently). Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt, 0005-add-UPDATE-.-IF-NOT-EXISTS-syntax.txt, 0006-Make-EXISTS-a-reserverd-keyword.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13645516#comment-13645516 ] Aleksey Yeschenko commented on CASSANDRA-5443: -- +1 Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt, 0005-add-UPDATE-.-IF-NOT-EXISTS-syntax.txt, 0006-Make-EXISTS-a-reserverd-keyword.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13644514#comment-13644514 ] Sylvain Lebresne commented on CASSANDRA-5443: - btw, I've also pushed a dtest at https://github.com/riptano/cassandra-dtest/blob/master/cql_tests.py#L3044 Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt, 0005-add-UPDATE-.-IF-NOT-EXISTS-syntax.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13645045#comment-13645045 ] Aleksey Yeschenko commented on CASSANDRA-5443: -- Mostly LGTM, the only issue I've spotted is that K_EXISTS has not been added to unreserved keywords. This is potentially breaking stuff (not sure about K_IF and K_NOT). Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt, 0005-add-UPDATE-.-IF-NOT-EXISTS-syntax.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13642958#comment-13642958 ] Jonathan Ellis commented on CASSANDRA-5443: --- bq. updating a row if it doesn't exist yet is not supported ... it's not really the right syntax We do need to support this use case one way or another. How about IF NOT EXISTS? Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13643028#comment-13643028 ] Sylvain Lebresne commented on CASSANDRA-5443: - bq. How about IF NOT EXISTS? That's definitively reasonable. I'll add a fifth patch to add that syntax soonish. Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 Attachments: 0001-Refactor-Update-and-Delete-statement-to-extract-common.txt, 0002-Add-syntax-to-support-conditional-update-delete.txt, 0003-Handle-deleted-and-expiring-column-in-paxos-updates.txt, 0004-Support-tombstones-when-comparing-for-CAS.txt -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13641701#comment-13641701 ] Sylvain Lebresne commented on CASSANDRA-5443: - bq. With regard to the result, it would be consistent with SQL to return a count of affected logical rows; not a boolean. I suppose that would work, but it feels to me that returning whether the condition did apply is more direct that the number of affected rows. I understand that the motivation is to mimick SQL more, but then we would need to return the number of affected rows for normal updates too (otherwise that would feel inconsistent to me). Also, my understanding (that is possibly broken) is that in SQL the number of affected rows is returned as some metadata of the query (typically, in JDBC, as the result value of executeUpdate()), not as a result set as we would do here, so would we be really fully consistent with SQL anyway? Anyway, not that I'm really against the idea, just wondering. Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13629075#comment-13629075 ] Sylvain Lebresne commented on CASSANDRA-5443: - So, here's my suggestion for a syntax: {noformat} UPDATE foo ATOMICALLY SET x = 3, y = 5, z = 'bar' IF x = 4, y = null WHERE k = 'mykey' {noformat} This would return a result set, and that result set might look like: {noformat} result -- true {noformat} where 'result' might be replaced by something more appropriate if someone has an idea. There is the question of whether we'd want to allow that in batches (in which case we would need to number the results or something), but I wonder if it's really worth bothering with that. Also, I think we might want to support a DELETE version, because otherwise I don't think one can delete a row conditionally. So something like: {noformat} DELETE ATOMICALLY FROM foo IF x = 3 WHERE k = 'key'; DELETE ATOMICALLY y, z FROM foo IF x = 3 WHERE k = 'key'; {noformat} Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Fix For: 2.0 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13629100#comment-13629100 ] Jonathan Ellis commented on CASSANDRA-5443: --- ATOMICALLY is redundant with the IF, isn't it? I'd prefer leaving it out but I guess I can live with it. I do have a stronger preference for IF being the last clause. That leaves the mutation (UPDATE ... WHERE) more separate from the condition instead of mixed together. (Yes, they do overlap at the WHERE still.) Let's ignore batches for now. +1 for DELETE. Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Fix For: 2.0 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13629111#comment-13629111 ] Sylvain Lebresne commented on CASSANDRA-5443: - bq. ATOMICALLY is redundant with the IF, isn't it? It is, strictly speaking. But adding it nails down the fact that this is a relatively specific operation, which fairly different performance characteristics, and one that returns a value. Also, I figured we may use something like atomic updates to describe them in the docs/presentations and so having atomic in the syntax would avoid having to add every time that's the ones with a IF. Overall, I have the feeling that having a clearer syntactic differentiation is probably good. bq. I do have a stronger preference for IF being the last clause. I'm perfectly fine with that. Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Fix For: 2.0 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CASSANDRA-5443) Add CAS CQL support
[ https://issues.apache.org/jira/browse/CASSANDRA-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13629462#comment-13629462 ] Rick Shaw commented on CASSANDRA-5443: -- With regard to the result, it would be cosistent with SQL to return a count of affected logical rows; not a boolean. Add CAS CQL support --- Key: CASSANDRA-5443 URL: https://issues.apache.org/jira/browse/CASSANDRA-5443 Project: Cassandra Issue Type: Sub-task Components: API, Core Reporter: Jonathan Ellis Assignee: Sylvain Lebresne Fix For: 2.0 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira