Transactions
A transaction is a way of grouping several reads and writes together. It then either:
* Succeeds (_commit_) * Fails (_abort_, _rollback_)
ACID
- Atomicity
- If anything happens while performing an operation, it's rolled-back so that it is then safe to retry (all-or-nothing).
- Consistency
- It's a property of the application, which guarantees that statements about data remains true (invariants), just like in accounting credits and debuts are always balanced.
- Isolation
- Makes clients think they are the only user of the database (no race condition)
- Durability
- Promise that once a transaction is committed, you are sure data will remain.
Datastores with leaderless replication usually does not follow this principle. So it's the application's responsibility to recover from errors.