NoSQL: Cassandra: Idempotent Updates

| | bookmark | email

Cassandra: Idempotent Updates

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.

via NoSQL databases