You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ali Akhtar <al...@gmail.com> on 2017/04/28 01:31:14 UTC

Counter being incremented extra times

I have the following schema:

CREATE TABLE total_volume (
team_id text,
channel_id text,
volume counter,
PRIMARY KEY (team_id, channel_id)
);

I've written an integration test, using CassandraUnit, which runs a loop
200 times and executes the query:

UPDATE total_volume SET volume = volume + 1 WHERE team_id = ? AND
channel_id = ?

200 times, using an Accessor (Java driver)

Afterwards, I read the volume back, using:

SELECT * FROM total_volume WHERE team_id = ? AND channel_id = ?

and block the thread until the volume returned is 200.

The problem is, this always gets stuck on 230, but not at 200.

Why is this happening? Since I incremented the counter exactly 200 times,
shouldn't the final value be 200 and not 230?