cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DuyHai Doan <doanduy...@gmail.com>
Subject Re: Counter column impossible to delete and re-insert
Date Thu, 06 Nov 2014 08:20:44 GMT
Hello Clément

This is a known anti-pattern. You should never re-use a deleted counter
column otherwise there will be unpredictable result for the counter value.
Le 6 nov. 2014 08:45, "Clément Fumey" <clement.fmy@gmail.com> a écrit :

> Hi,
>
> I have a table with counter column . When I insert (update) a row, delete
> it and try to re-insert, it fail to re-insert the row. Here is the commands
> i use :
>
> CREATE TABLE test(
>     testId int,
>     year int,
>     testCounter counter,
>     PRIMARY KEY (testId, year)
> )WITH CLUSTERING ORDER BY (year DESC);
>
> UPDATE test SET testcounter = testcounter +5 WHERE testid = 2 AND year =
> 2014;
> DELETE FROM test WHERE testid = 2 AND year = 2014;
> UPDATE test SET testcounter = testcounter +5 WHERE testid = 2 AND year =
> 2014;
>
> The last command failed, there is no error message but the table is empty
> after it.
> Is that normal? Am I doing something wrong?
>
> Regards
>
> Clément
>

Mime
View raw message