I haven't been very accurate in my first answer indeed, which was misleading. Apache Cassandra guarantees that if all queries are ran at least at quorum, a client writing successfully (as in the cluster acknowledged the write) then reading his previous write will see the correct value unless another client updated it between the write and the read (which would be a race condition). Same goes for two different clients if the first issues a successful write and only after that the second reads the value. Quorum provides consistency guaranty if queries are fired in sequence.
Without diving into complex scenarios where it may work because of read repair and the fact that everything is async, Ken's use case was : C1 writes, it is not successful yet, C2 and C3 read at the approx. same time. Once again, in this case C2 and C3 could be reading a different value as C1's mutation could be in pending state on some nodes. Considering we have nodes A, B and C : - Node A has received the write from C1, nodes B and C have not - C2 reads from A and B, there's a digest mismatch which triggers a foreground read repair (background read repairs are triggered at CL ONE) > it gets the up to date value that was written by C1 - C3 reads from B and C, there's no digest mismatch and the value is not up to date with A > it does not get the value written by C1 Cheers, On Thu, Sep 15, 2016 at 12:10 AM Tyler Hobbs <[email protected]> wrote: > > On Wed, Sep 14, 2016 at 3:49 PM, Nicolas Douillet < > [email protected]> wrote: > >> >> - >> - during read requests, cassandra will ask to one node the data and >> to the others involved in the CL a digest, and if all digests do not >> match, >> will ask for them the entire data, handle the merge and finally will ask >> to >> those nodes a background repair. Your write may have succeed during this >> time. >> >> > This is very good info, but as a minor correction, the repair here will > happen in the foreground before the response is returned to the client. > So, at least from a single client's perspective, you get monotonic reads. > > > -- > Tyler Hobbs > DataStax <http://datastax.com/> > -- ----------------- Alexander Dejanovski France @alexanderdeja Consultant Apache Cassandra Consulting http://www.thelastpickle.com
