cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaydeep Chovatia <chovatia.jayd...@gmail.com>
Subject Lightweight tx is good enough to handle counter?
Date Fri, 23 Sep 2016 18:10:08 GMT
We have a following table:

create table mytable {

id int,
count int static,
rec_id int,
primary key (id, rec_id)

};

The count in the table represents how many records (rec_id clustering
columns) exists. So when we add new a new record we do it following way:

UNLOGGED BATCH
insert into mytable (id, rec_id) values (<id>, <rec_id>);
update mytable set count = <read_count> + 1 where id = <id> if count =
<read_count>; //light-weight transaction
APPLY BATCH

Then we do following read query as QUORUM:

select count, rec_id from mytable where id = <id>;

Here we expect count to exactly match number of rows (number of clustering
rec_id) returned. But under a stress we have observed that they do not
match sometimes.

Is this expected?

Thanks,
Jaydeep

Mime
View raw message