How exactly batch work in cql

1k views Asked by At

I was going through datastax CQL Java Driver 2.1 driver document and also through CQL 2.X reference pdf:

In CQL reference pdf:

Batches are atomic by default. In the context of a Cassandra batch operation, 
atomic means that if any of the batch succeeds, all of it will. 

In CQL java driver pdf:

Batch operations
The BATCH statement combines multiple data modification statements (INSERT, UPDATE, DELETE) into
a single logical operation which is sent to the server in a single request. Also batching together multiple
operations ensures these are executed in an atomic way: either all succeed or none.

So what i understood from first, that a batch is success even if a single query inside batch is sucess.

from second i understood that a batch is failed even if a single query inside batch fails

So what is the exact thing ?

1

There are 1 answers

1
phact On BEST ANSWER

The purpose of logged batches is atomicity. If any one query in the batch fails the entire batch will fail and if the batch succeeds, that means every query in the batch succeeded.

either all succeed or none is accurate.