You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Aleksey Yeschenko (JIRA)" <ji...@apache.org> on 2013/12/28 01:33:51 UTC

[jira] [Comment Edited] (CASSANDRA-6532) Deleting and re-adding counter causes null count value.

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

Aleksey Yeschenko edited comment on CASSANDRA-6532 at 12/28/13 12:33 AM:
-------------------------------------------------------------------------

It's not 'hard to fix' - it's a fundamental limitation. As I said before, deletes do not commute.

bq. Minimally, it should throw an error if you're not going to fix it....

Can't be done, either, since it would require a non-local read before a counter write, which is a no-go.

There are basically only two options: 1) allow deletes, but, once deleted, make counters non-reusable and 2) don't allow deletes at all.

We've chosen 1).


was (Author: iamaleksey):
It's not 'hard to fix' - it's a fundamental limitation. As I said before, deletes do not commute.

bq. Minimally, it should throw an error if you're not going to fix it....

Can't be done, either, since it would require a non-local read before a counter write, which is a no-go.

There are basically only two options: 1) allow deletes, but, once deleted, make counters non-reusable and 2) don't allow deletes at all.

We've chosen 2).

> Deleting and re-adding counter causes null count value.
> -------------------------------------------------------
>
>                 Key: CASSANDRA-6532
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6532
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>         Environment: cqlsh 4.1.0 | Cassandra 2.0.3 | CQL spec 3.1.1 | Thrift protocol 19.38.0
>            Reporter: Gregory Ramsperger
>              Labels: counters
>
> After a specific counter has been deleted, recreating a new counter with the same key causes the value to be permanently null.
> {noformat}
> cqlsh:demo> create table DemoCounter ( pk  text primary key, cnt counter );
> cqlsh:demo> update DemoCounter set cnt = cnt + 1 where pk = 'foo';
> cqlsh:demo> select * from DemoCounter;
>  pk  | cnt
> -----+-----
>  foo |   1
> (1 rows)
> cqlsh:demo> delete from DemoCounter where pk = 'foo';
> cqlsh:demo> select * from DemoCounter;
> (0 rows)
> cqlsh:demo> update DemoCounter set cnt = cnt + 1 where pk = 'foo';
> cqlsh:demo> select * from DemoCounter;
>  pk  | cnt
> -----+------
>  foo | null
> (1 rows)
> cqlsh:demo>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)