ACID

In computer science, ACID (atomicity, consistency, isolation, durability) is a set of properties of database transactions intended to guarantee data validity despite errors, power failures, and other mishaps

Atomicity

Atomicity guarantees that each transaction is treated as a single "unit", which either succeeds completely, or fails completely: if any of the statements constituting a transaction fails to complete, the entire transaction fails and the database is left unchanged

An atomic system must guarantee atomicity in each and every situation, including power failures, errors and crashes

Consistency (Correctness)

Consistency ensures that a transaction can only bring the database from one valid state to another, maintaining database invariants: any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof

Isolation

Isolation

Transactions are often executed concurrently (e.g., multiple transactions reading and writing to a table at the same time). Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially.

Isolation is the main goal of concurrency control;

depending on the method used, the effects of an incomplete transaction might not even be visible to other transactions. [7]

隔离等级:

  • Serializable
  • Repeatable reads
  • Read committed
  • Read uncommitted

Durability

Durability guarantees that once a transaction has been committed, it will remain committed even in the case of a system failure (e.g., power outage or crash).

This usually means that completed transactions (or their effects) are recorded in non-volatile memory

参考文档

acid wiki