cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Guyomar <>
Subject Re: Batch : Isolation and Atomicity for same partition on multiple table
Date Wed, 13 Dec 2017 10:18:16 GMT
Hi Mickael,

Partition are related to the table they exist in, so in your case, you are
targeting 2 partitions in 2 different tables.
Therefore, IMHO, you will only get atomicity using your batch statement

On 11 December 2017 at 15:59, Mickael Delanoë <> wrote:

> Hello,
> I have a question regarding batch isolation and atomicity with query using
> a same partition key.
> The Datastax documentation says about the batches :
> "Combines multiple DML statements to achieve atomicity and isolation when
> targeting a single partition or only atomicity when targeting multiple
> partitions. A batch applies all DMLs within a single partition before the
> data is available, ensuring atomicity and isolation.""
> But I try to find exactly what can be considered as a "single partition"
> and I cannot find a clear response yet. The examples and explanations
> always speak about partition with only one table used inside the batch. My
> concern is about partition when we use different table in a batch. So I
> would like some clarification.
> Here is my use case, I have 2 tables with the same partition-key which is
> "user_id" :
>    user_id text,
>    clustering text,
>    value text,
>    PRIMARY KEY (user_id, clustering));
>    user_id text,
>    clustering1 text,
>    clustering2 text,
>    value text,
>    PRIMARY KEY (user_id, clustering1, clustering2));
> If I do a batch query like this :
> INSERT INTO tableA (user_id, clustering, value) VALUES ('1234', 'c1',
> 'val1');
> INSERT INTO tableB (user_id, clustering1, clustering1, value) VALUES
> ('1234', 'cl1', 'cl2', 'avalue');
> the DML statements uses the same partition-key, can we say they are
> targetting the same partition or, as the partition key are for different
> table, should we consider this is different partition? And so does this
> batch ensure atomicity and isolation (in the sense described in Datastax
> doc)? Or only atomicity?
> Thanks for you help,
> Mickaël Delanoë

View raw message