ACID (atomicity, consistency, isolation, durability) is a set of properties of database transactions intended to guarantee validity even in the event of errors, power failures, etc. These four properties describe the major guarantees of the transaction paradigm, which has influenced many aspects of development in database systems.

Atomicity

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.

Consistency failure

A very general term, which demands that the data must meet all validation rules.

Durability failure

Consider a transaction that transfers 10 from A to B. First, it removes 10, then adds 10. At this point, the user is told the transaction was a success and the changes are still queued in the disk buffer waiting to be committed to disk. The user assumes (understandably) that the changes persist

Locking vs multiversioning

Locking means that the transaction marks the data that it accesses so that the DBMS knows not to allow other transactions to modify it until the first transaction succeeds or fails.

Examples

The following examples further illustrate the ACID properties.

Distributed transactions

The two-phase commit protocol provides atomicity for distributed transactions to ensure that each participant in the transaction agrees on whether the transaction should be committed or not

Atomicity

The guarantee that series of database operations in an atomic transaction will either all occur (a successful operation), or none will occur (an unsuccessful operation).

Isolation failure

If two transactions execute at the same time, each attempting to modify the same data, one must wait until the other completes to maintain isolation.

Consistency

This ensures that a transaction can only bring the database from one valid state to another, maintaining database invariants

Isolation

Concurrent execution ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially

Implementation

There are two popular families of techniques: write-ahead logging and shadow paging

Source

Get in