With Cassandra, the closest we get to a transaction is a “batch mutate”, which allows us to submit multiple updates in one request. But while those updates are being applied, they can be immediately accessed by other applications. If our application (or Cassandra) crashes, there’s no guarantee about which updates in the batch will succeed. Without ACID transactions, how do we prevent conflicts between applications? How do we recover if a crash occurs?
One strategy is to design updates to be idempotent, which means that applying the same update twice produces the same results as applying the update once. In other words, if an update is successfully processed once, applying the same update again is essentially a no-op. As we’ll see in a moment, this strategy not only simplifies restarts after a crash, it can prevent conflicts between multiple updaters.
Idempotent operations is the way to go, but do not confuse batched operations (meant to reduce round trips) with transactions (isolation, rollback, etc.). Not even Redis single threaded MULTI/EXEC/DISCARD is equivalent to transactions.
Original title and link: Cassandra: Idempotent Updates (NoSQL databases © myNoSQL)