1 year ago

#330504

test-img

Carlo De Vita

Cassandra counter - consistency

I have a doubt about counters. I'm searching on the web but I'm not able to find an answer. Let's suppose we're working with a COUNTER across multiple datacenters, and let's suppose we're working using a local quorum consistency level. If concurrently, two client in two different datacenters update the COUNTER value, are we sure that, after all synchronization time between the datacenters, the COUNTER will have the correct value at the end (considering both the operations)? I will make an example:

At time t0 Counter = 0

At time t1 At datacenter 1 , the client1 executes counter = counter + 10. At datacenter 2, the client2 executes counter = counter + 20. So at this time t1, for DC1 the counter is 10, for DC2 the counter is 20.

At time t2 ( after that Datacenters have communicated their data) What happen to COUNTER? Is it correctly set to 30 ? Or there is the possibility that could be 10 or 20?

Just adding a note: I don't want that immediately the counters have the correct value, I want to accept that there is a time in which the DCs are not synchronized. In that case I understand I have to use a stronger consistency level. But I want to be sure to not create a permanent inconsistence updating the counter. So my hope is that Cassandra is able to understand that there have been 2 update operation, even if they've been on the same "object

I hope I've been clear. Thanks for the support,

Carlo

cassandra

cassandra-3.0

distributed-system

eventual-consistency

0 Answers

Your Answer

Accepted video resources