Hi Jonathan,

I’m still a bit unclear on this. Say I have two CQL3 tables:
- user (replication of 3)
- user_email_index (replication of 3)

Now I create a new logged batch at quorum consistency level and put two inserts 
in there:
#1 Insert into the “user" table with partition key of a timeuuid of the user 
#2 Insert into the “user_email_index" with partition key of user’s email 
address 

As you can see, there is a chance that these two insert statements will be 
executed on two different nodes because they are keyed by different partition 
keys. So based on the docs for Logged Batches, a batch will be applied 
“eventually” in an "all or nothing” fashion. So my question is, what happens if 
insert #1 fails (say replicas are unavailable), would insert #2 get applied? 
Would the whole thing be rejected and return an error to the client? 

PS. I’m aware of the isolation guarantees and that’s not an issue. All I need 
to make sure is that if the first the statement failed, the whole batch needs 
to fail.

Thanks,

Drew

On Mar 17, 2014, at 5:33 AM, Jonathan Lacefield <jlacefi...@datastax.com> wrote:

> Hello,
> 
>   Consistency is declared at the statement level, i.e. batch level when 
> writing, but enforced at each batch row level.  My understanding is that each 
> batch (and all of it's contents) will be controlled through a specific CL 
> declaration.  So batch A could use a CL of QUORUM while batch B could use a 
> CL of ONE.   
> 
>   The detail that may help sort this out for you is that batch statements do 
> not provide isolation guarantees: 
> www.datastax.com/documentation/cql/3.0/cql/cql_reference/batch_r.html.  This 
> means that you write the batch as a batch but the reads are per row.  If you 
> are reading records contained in the batch, you will read results of 
> partially updated batches.  Taking this into account for your second 
> question, you should expect that your read CL will preform as it would for 
> any individual row mutation. 
> 
>   Hope this helps.
> 
> Jonathan
> 
> Jonathan Lacefield
> Solutions Architect, DataStax
> (404) 822 3487
> 
> 
> 
> 
> 
> 
> On Sat, Mar 15, 2014 at 12:23 PM, Drew Kutcharian <d...@venarc.com> wrote:
> Hi Guys,
> 
> How do Atomic Batches and Consistency Level relate to each other? More 
> specifically:
> 
> - Is consistency level set/applicable per statement in the batch or the batch 
> as a whole?
> 
> - Say if I write a Logged Batch at QUORUM and read it back at QUORUM, what 
> can I expect at normal, single node replica failure or double node replica 
> failure scenarios?
> 
> Thanks,
> 
> Drew
> 

Reply via email to