Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between unlogged and logged Cassandra batches in negative cases

Tags:

cassandra

I understand the basic difference between LOGGED and UNLOGGED batches in Cassandra in terms of atomicity. Essentially, LOGGED batches are atomic while UNLOGGED are not. This means that all statements in a LOGGED batch get executed (or not executed) all together.

In the case of an UNLOGGED batch, if something goes wrong during the write operation of a composing statement, I know that the already executed statements are NOT rolledback, but does Cassandra notify the failure of the whole batch to the driver ?

like image 868
Nicola Ferraro Avatar asked Dec 26 '14 16:12

Nicola Ferraro


1 Answers

So logged batches use a log to record the batch operation and then execute it, removing it from the log when it is successful. Unlogged is still a batch operation but without the overhead of the log. In small amounts logged are ok but as you scale up this batch log could grow and become a problem point. The Datastax docs actually cover batching and some examples:

https://docs.datastax.com/en/dse/6.0/cql/cql/cql_using/useBatch.html

Example of good batches

Example of bad batches

Generally speaking batches have their use but I have seen them cause performance problems when overused because of the penalty you pay for grouping them up on a coordinator node. I often point folks to this well known blog that outlines some useful info on batches too

like image 154
markc Avatar answered Nov 03 '22 04:11

markc