Search code examples
cassandrareplicationdistributedconsistencynosql

In Cassandra how simultaneous distributed writes maintain consistency?


There is a three node Cassandra cluster with replication factor 3 and consistency quorum with nodes X, Y, Z. So either of the three can be the coordinator.

Assuming there are two simultaneous operations executed at the same time one as coordinator X and other with coordinator Z to change the status.

Operation 1 (On X): to change the status from 0 -> 1 Operation 2 (On Z): to change the status from 0 -> 2

Now the final state should be of Value 2, but what if Operation 2 is executed before Operation 1, what would be the final status?

Thanks for your help.


Solution

  • Last Write Win e.g. the mutation with the highest timestamp always win. See those slides: http://www.slideshare.net/doanduyhai/cassandra-introduction-parisjug/44