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 2014/12/16 13:19:13 UTC

[jira] [Resolved] (CASSANDRA-8491) Updating counter after previous removal doesn't work

     [ https://issues.apache.org/jira/browse/CASSANDRA-8491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Yeschenko resolved CASSANDRA-8491.
------------------------------------------
    Resolution: Not a Problem

Unfortunately, that's just how counters work. Deletes don't commute with updates.

See CASSANDRA-7346.

> Updating counter after previous removal doesn't work
> ----------------------------------------------------
>
>                 Key: CASSANDRA-8491
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8491
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra 2.1.2
>            Reporter: mlowicki
>
> {code}
> cqlsh:sync> desc table user_quota;
> CREATE TABLE sync.user_quota (
>     user_id text PRIMARY KEY,
>     entities counter
> ) WITH bloom_filter_fp_chance = 0.01
>     AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
>     AND comment = ''
>     AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
>     AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
>     AND dclocal_read_repair_chance = 0.1
>     AND default_time_to_live = 0
>     AND gc_grace_seconds = 864000
>     AND max_index_interval = 2048
>     AND memtable_flush_period_in_ms = 0
>     AND min_index_interval = 128
>     AND read_repair_chance = 0.0
>     AND speculative_retry = '99.0PERCENTILE';
> cqlsh:sync> select * from user_quota where user_id = 'test';
>  user_id | entities
> ---------+----------
> (0 rows)
> cqlsh:sync> update user_quota set entities = entities + 100 where user_id = 'test';
> cqlsh:sync> select * from user_quota where user_id = 'test';
>  user_id | entities
> ---------+----------
>     test |      100
> (1 rows)
> cqlsh:sync> update user_quota set entities = entities + 100 where user_id = 'test';
> cqlsh:sync> select * from user_quota where user_id = 'test';
>  user_id | entities
> ---------+----------
>     test |      200
> (1 rows)
> cqlsh:sync> delete from user_quota where user_id = 'test';
> cqlsh:sync> select * from user_quota where user_id = 'test';
>  user_id | entities
> ---------+----------
> (0 rows)
> cqlsh:sync> update user_quota set entities = entities + 100 where user_id = 'test';
> cqlsh:sync> select * from user_quota where user_id = 'test';
>  user_id | entities
> ---------+----------
> (0 rows)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)