Two shoppers reach for the last pair of sneakers. An order needs to be recorded and inventory updated without leaving the database in a half-finished state. ACID names four transaction guarantees that help protect data integrity: atomicity, consistency, isolation, and durability. section 8.2.1
Each guarantee tackles a different failure risk:
- Atomicity — all or nothing. Deducting inventory and creating the order form one transaction. If it fails halfway through, the changes roll back. section 8.2.1
- Consistency — follow the rules. A transaction moves the database from one valid state to another; a constraint against negative inventory can reject an overselling attempt. section 8.2.1
- Isolation — don't expose the half-finished work. In the purchase example, another reader sees inventory before or after the transaction, not its intermediate calculation. section 8.2.1
- Durability — keep the committed result. Once the order transaction commits, its result remains recorded even if the database server fails afterward. section 8.2.1
ACID is not exclusive to relational databases: MongoDB and DynamoDB also offer multi-document ACID transactions. When services do not share an ACID transaction, consistency needs a different approach. A saga sequences local transactions with compensating fallbacks; a transactional outbox helps guarantee network events are published. section 8.2.5 section 12.11









