With the Data not shared model, how does a client or query get a consistent data and how does a write ensure that it is writing right data.
Obvious answer is the maintaining consistency in a database involves in adhering the ACID Properties.
Cassandra follows Atomicity, Isolation, Durability but consistency is an eventual consistency or a Tunable Consistency.
Having said that, data will eventually become consistent among nodes.
What is eventual consistency?
ANS: The data will become consistency when required or by on Demand over a period of time.
But, Does client need to wait until it become consistent?
ANS: No, when client send a request for data, the underlying query have a consistency level for a session level or query level , for which ALL, ANY, ONE etc. should be mentioned,
For example: select * from Portfolios.PortfolioDemo USING CONSISTENCY ALL|ONE|TWO|THREE|QUORUM|LOCAL QUORUM
When replication factor is set and read happens the co-ordinator that receives the client request will send a request to the nodes that contain the partition range of data and nodes will revert back with data to coordinator node. Whilst its the coordinator node to merge all the parts of the data and check with digest it received from each node and see the data is latest. If any node data is not matched with digest then that node data will be repaired in backend and so forth become consistent eventually.
I do not want to waste any efforts in rewriting this stuff since Datastax documentation has very good page for Read/Write Paths in Cassandra with all scenarios.
https://docs.datastax.com/en/cassandra_win/2.2/cassandra/dml/dmlClientRequestsReadExp.html
https://docs.datastax.com/en/cassandra_win/2.2/cassandra/dml/dmlClientRequestsWrite.html
So with Consistency Levels in place and the digest matching and read repair online, the Data that retrieves Cassandra ensures consistency of data can be achieved eventually and depends on your requirement.
Next Post High Availability Comparing with Oracle RAC, cluster interconnect, node evictions etc.
Follow Me!!!