cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brice Dutheil <brice.duth...@gmail.com>
Subject BATCH consistency level VS. individual statement consistency level
Date Mon, 06 Jul 2015 10:36:31 GMT
Hi,

I’m not sure how consistency level is applied on batch statement. I didn’t
found detailed information on datastax.com (1)
<http://docs.datastax.com/en/cql/3.0/cql/cql_reference/batch_r.html>
regarding that.

   - It is possible to set a CL on individual statements.
   - It is possible to set a CL on the whole batch.
   - If CL is not set then the default CL is used (2)
   <http://docs.datastax.com/en/cql/3.0/cql/cql_reference/consistency_r.html>
   which is ONE (3)
   <http://docs.datastax.com/en/cassandra/1.2/cassandra/dml/dml_config_consistency_c.html?scroll=concept_ds_umf_5xx_zj__configuring-client-consistency-levels>

I understand that if the CL is only set on the batch, then this CL will be
applied to individual statements.

But how are applied consistency levels in these cases ?

   1.

   when consistency levels differ between statements and batch :

    BEGIN BATCH USING CONSISTENCY QUORUM
      INSERT INTO users (...) VALUES (...) USING CONSISTENCY LOCAL_QUORUM
      UPDATE users SET password = '...' WHERE userID = '...'  USING
CONSISTENCY LOCAL_ONE
      ...
    APPLY BATCH;

   2.

   when consistency level is set on statement but not on batch (will it be
   overridden to default consistency level, i.e. ONE ?)

    BEGIN BATCH
      INSERT INTO users (...) VALUES (...) USING CONSISTENCY LOCAL_QUORUM
      UPDATE users SET password = '...' WHERE userID = '...'  USING
CONSISTENCY LOCAL_ONE
      ...
    APPLY BATCH;


Cheers,
— Brice
​

Mime
View raw message