You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Praveen Baratam <pr...@gmail.com> on 2012/04/24 16:38:04 UTC

Consistency with Sequential Mutation/Access?

I will start with a hypothetical scenario to make my question easy to
comprehend.

Time 1: Client A updates Row 1 in CF C. N=3, W=1

Time 2: Client A reads Row1 in CF C. N=3, R=1

Can we expect the update to be seen by all replicas and reply consistently
in T2?

I presume Cassandra queues job messages on each node for execution. And
because the coordinator node sends write messages to all replicas
irrespective of how many replicas it  waits for ACK, the READ Job will be
executed on each replica after the WRITE job, essentially delivering
consistent data on sequential access.

Is this the way or there is no order in which messages are received and
processed?

Re: Consistency with Sequential Mutation/Access?

Posted by Russell Haering <ru...@gmail.com>.
On Tue, Apr 24, 2012 at 7:38 AM, Praveen Baratam
<pr...@gmail.com> wrote:
> I will start with a hypothetical scenario to make my question easy to
> comprehend.
>
> Time 1: Client A updates Row 1 in CF C. N=3, W=1
>
> Time 2: Client A reads Row1 in CF C. N=3, R=1
>
> Can we expect the update to be seen by all replicas and reply consistently
> in T2?

To get the behavior you want you need W+R > N (and Client A needs to
have received confirmation of the successful write before performing
the read).

With W = 1, two replicas could be unavailable to the coordinator node
and not receive the update. They should *eventually* receive the
update, but if you read with R = 1 before they do so, it is possible
that the value you are reading is a stale value from a previously
unavailable node.

If you used W = 2 then by the time the write successfully completes
the updated value must be on 2 of the 3 replicas. A read with R = 2
then cannot complete without finding and returning the new value.

Re: Consistency with Sequential Mutation/Access?

Posted by Niklas Ekström <ni...@sics.se>.
On tis, 2012-04-24 at 20:08 +0530, Praveen Baratam wrote:
> I will start with a hypothetical scenario to make my question easy to
> comprehend.
> 
> Time 1: Client A updates Row 1 in CF C. N=3, W=1
> 
> Time 2: Client A reads Row1 in CF C. N=3, R=1
> 
> Can we expect the update to be seen by all replicas and reply consistently
> in T2?
> 
> I presume Cassandra queues job messages on each node for execution. And
> because the coordinator node sends write messages to all replicas
> irrespective of how many replicas it  waits for ACK,

But there is no guarantee that all replicas receives the write messages
just because the messages were sent. Perhaps at T1 there was a (long
lasting) network partition and only the replica that responded with an
ACK actually got the message. Then at T2 the network partition may have
healed and the replica that ACK'ed the write may have crashed.

> the READ Job will be
> executed on each replica after the WRITE job, essentially delivering
> consistent data on sequential access.
> 
> Is this the way or there is no order in which messages are received and
> processed?

Niklas