[
https://issues.apache.org/jira/browse/CASSANDRA-6430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14017511#comment-14017511
]
Sylvain Lebresne commented on CASSANDRA-6430:
---------------------------------------------
Definitively something we need to fix. That said, the first step here is
probably to refuse conditions when the delete statement applies to multiple
rows, because the code currently doesn't handle it and the fact we let the
query fly is mainly a lack of validation.
In the longer run, it's possible to make such query work, but it's unclear to
me whether that's a good idea or not (to be read as 'my initial hunch is that
it's a bad idea'). Mainly because such query means we'll have to read the full
partition during the Paxos rounds, thus making it pretty easy to OOM the
server. Also, if we do handle such query, the condition will not only be a
condition on the application of the statement anymore, but potentially a
selection on what gets deleted. And I'm not sure we have a good way to indicate
in the resultSet what got deleted and what didn't, which is something one
would expect.
> DELETE with IF <field>=<value> clause doesn't work properly if more then one
> row are going to be deleted
> --------------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-6430
> URL: https://issues.apache.org/jira/browse/CASSANDRA-6430
> Project: Cassandra
> Issue Type: Bug
> Reporter: Dmitriy Ukhlov
>
> CREATE TABLE test(key int, sub_key int, value text, PRIMARY KEY(key, sub_key)
> );
> INSERT INTO test(key, sub_key, value) VALUES(1,1, '1.1');
> INSERT INTO test(key, sub_key, value) VALUES(1,2, '1.2');
> INSERT INTO test(key, sub_key, value) VALUES(1,3, '1.3');
> SELECT * from test;
> key | sub_key | value
> -----+---------+-------
> 1 | 1 | 1.1
> 1 | 2 | 1.2
> 1 | 3 | 1.3
> DELETE FROM test WHERE key=1 IF value='1.2';
> [applied]
> -----------
> False <=============== I guess second row should be removed
> SELECT * from test;
> key | sub_key | value
> -----+---------+-------
> 1 | 1 | 1.1
> 1 | 2 | 1.2
> 1 | 3 | 1.3
> (3 rows)
> DELETE FROM test WHERE key=1;
> SELECT * from test;
> (0 rows) <=========== all rows were removed: OK
--
This message was sent by Atlassian JIRA
(v6.2#6252)