You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by A J <s5...@gmail.com> on 2011/02/15 19:38:08 UTC

What if write consistency level cannot me met ?

Say I set write consistency level to ALL and all but one node are down. What
happens to writes ? Does it rollback from the live node before returning
failure to client ?

Thanks.

Re: What if write consistency level cannot me met ?

Posted by Aaron Morton <aa...@thelastpickle.com>.
Here's my understanding....

The request will not start if CL nodes are not up from the point of view of the coordinator (when considering a single mutation). I the case described where the CL is ALL, the write would not start and UnavailableException would be thrown. This comes from IWriteResponseHandler.assureSufficientNodes() . Same thing happens on reads, we're not going to start a request we know cannot succeed.

if CL nodes are up and the write starts, but less then CL nodes return by rpc_timeout the AbstractWriteResponseHandler ( or ReadCallback for reads) will raise a TimeoutException,  o.a.c.t.CassandraServer is will catch this and turn it into the thrift TimedoutException. 

So in general:
- UnavailableException means the request could not start (insufficient CL, or node bootstrapping or any node down when doing schema ops)
- TimedoutException means we started and timed out. 

In both cases you can retry. 

Aaron


On 16 Feb, 2011,at 09:11 AM, Matthew Dennis <md...@datastax.com> wrote:

But you can not depend on such behavior.  If you do a write and you get an unavailable exception, the only thing you know is at that time it was not able to be placed on all the nodes required to meet your CL.  It may eventually end up on all those nodes, it may not be on any of the nodes or at the time you read the reply it could be on some subset of the nodes.  Regardless of the outcome, it is safe to retry.

On Tue, Feb 15, 2011 at 2:00 PM, Aaron Morton <aa...@thelastpickle.com> wrote:
The write will not start if there are insufficient nodes up. In this case (All cl) you would get an error and nothing would be committed to disk. You would get an Unavailable exception.

Aaron


On 16/02/2011, at 7:46 AM, Thibaut Britz <th...@trendiction.com> wrote:

> Your write will fail. But if the write has reached  at least one node,
> it will eventually reach all the other nodes as well. So it won't
> rollback.
>
>
> On Tue, Feb 15, 2011 at 7:38 PM, A J <s5...@gmailcom> wrote:
>> Say I set write consistency level to ALL and all but one node are down. What
>> happens to writes ? Does it rollback from the live node before returning
>> failure to client ?
>> Thanks.


Re: What if write consistency level cannot me met ?

Posted by Matthew Dennis <md...@datastax.com>.
But you can not depend on such behavior.  If you do a write and you get an
unavailable exception, the only thing you know is at that time it was not
able to be placed on all the nodes required to meet your CL.  It may
eventually end up on all those nodes, it may not be on any of the nodes or
at the time you read the reply it could be on some subset of the nodes.
Regardless of the outcome, it is safe to retry.

On Tue, Feb 15, 2011 at 2:00 PM, Aaron Morton <aa...@thelastpickle.com>wrote:

> The write will not start if there are insufficient nodes up. In this case
> (All cl) you would get an error and nothing would be committed to disk. You
> would get an Unavailable exception.
>
> Aaron
>
> On 16/02/2011, at 7:46 AM, Thibaut Britz <th...@trendiction.com>
> wrote:
>
> > Your write will fail. But if the write has reached  at least one node,
> > it will eventually reach all the other nodes as well. So it won't
> > rollback.
> >
> >
> > On Tue, Feb 15, 2011 at 7:38 PM, A J <s5...@gmail.com> wrote:
> >> Say I set write consistency level to ALL and all but one node are down.
> What
> >> happens to writes ? Does it rollback from the live node before returning
> >> failure to client ?
> >> Thanks.
>

Re: What if write consistency level cannot me met ?

Posted by Aaron Morton <aa...@thelastpickle.com>.
The write will not start if there are insufficient nodes up. In this case (All cl) you would get an error and nothing would be committed to disk. You would get an Unavailable exception.

Aaron

On 16/02/2011, at 7:46 AM, Thibaut Britz <th...@trendiction.com> wrote:

> Your write will fail. But if the write has reached  at least one node,
> it will eventually reach all the other nodes as well. So it won't
> rollback.
> 
> 
> On Tue, Feb 15, 2011 at 7:38 PM, A J <s5...@gmail.com> wrote:
>> Say I set write consistency level to ALL and all but one node are down. What
>> happens to writes ? Does it rollback from the live node before returning
>> failure to client ?
>> Thanks.

Re: What if write consistency level cannot me met ?

Posted by Thibaut Britz <th...@trendiction.com>.
Your write will fail. But if the write has reached  at least one node,
it will eventually reach all the other nodes as well. So it won't
rollback.


On Tue, Feb 15, 2011 at 7:38 PM, A J <s5...@gmail.com> wrote:
> Say I set write consistency level to ALL and all but one node are down. What
> happens to writes ? Does it rollback from the live node before returning
> failure to client ?
> Thanks.