[
https://issues.apache.org/jira/browse/CASSANDRA-6509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pardeep Singh updated CASSANDRA-6509:
-------------------------------------
Labels: collections cql3 list (was: cql3)
> CQL collection list throws error on delete (hiding the error will help)
> -----------------------------------------------------------------------
>
> Key: CASSANDRA-6509
> URL: https://issues.apache.org/jira/browse/CASSANDRA-6509
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Pardeep Singh
> Priority: Minor
> Labels: collections, cql3, list
>
> Currently as of CQL 3.1, collection list query throws error.
> DELETE scores[1] FROM plays WHERE id = '123-afde'; //
> deletes the 2nd element of scores (raises an error is scores has less than 2
> elements)
> The above query is not an issue for single queries since I can ignore the
> error. But if I do a batch, the above query will fail and the batch will fail
> also.
> I was trying to accomplish this:
> BEGIN UNLOGGED BATCH
> DELETE scores[499] FROM plays WHERE id = '123-afde';
> DELETE scores[499] FROM plays WHERE id = '144-afde';
> APPLY BATCH;
> My main goal is to keep a list of 500 recent posts, delete the rest. So I'm
> inserting to list by prepending an ID, then deleting from the end of the
> list. I can deal with it if the list is not exact 500 posts, the point is to
> keep it close to that number.
> I'm doing this in bulk so using BATCH helps improve performance and I'm also
> using UNLOGGED BATCH since deleting is not critical part of the process.
> By not throwing error on the above query, other use cases can be implemented:
> BEGIN BATCH
> UPDATE scores=[2]+scores WHERE id='aaa';
> DELETE scores[500] FROM plays WHERE id = 'aaa';
> APPLY BATCH;
> By using atomic BATCH, I can cap the list at 500 elements.
> It would help, even if you can provide a way to bypass the delete error using
> some special directive so the BATCH can still be processed.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)