Logged BATCH atomicity

Hi everyone,

I’m using denormalized tables with different partition keys (e.g., orders_by_order_id, orders_by_customer_id by customer_id, orders_by_merchant_id by merchant_id).

When I write to all three tables using a logged BATCH:

BEGIN BATCH
   INSERT INTO orders (order_id, ...) VALUES (...);
   INSERT INTO orders_by_customer_id (customer_id, order_id, ...) VALUES (...);
   INSERT INTO orders_by_merchant_id (merchant_id, order_id, ...) VALUES (...);
APPLY BATCH;

This pattern is also mentioned “ScyllaDB in action”, chapter 6.4.

My Questions:

The batch will be executed against 3 different tables with 3 different partition keys. Will the batch log ensure ALL three inserts eventually succeed, or can some succeed while others fail permanently?

Logged batches have a built-in retry mechanism. If any of the member statements fail, the whole batch is retried later, until eventually all member statements succeed.

Note that before the batch succeeds eventually, it is possible to have an intermediate state where some of the statements succeeded and some haven’t.