Skip to content

Transactions

Jan Wiemer edited this page Dec 23, 2020 · 12 revisions

Transactions

The definition of transaction is a unit of "work" that is atomic meaning that either all the work is done or nothing at all. The "work" usually includes the modification of shared resources, e.g. data stored in a database, but also data stored in a transient store. The modifications done in context of a transaction can either be committed or rolled back: a commit means that all modifications actually take place, a rollback means that all modifications are reverted. Transactions are typically characterized by the four ACID properties: Atomicity, Consistency, Isolation and Durability.

Figure 1: Atomicity

Atomicity

Figure 2: Consistency

Consistency

Figure 3: Isolation

Isolation

Figure 4: Durability

Durability

Atomicity

All modifications done in context of the transaction are performed in a single atomic operation. Either all modification are performed (after a commit) or none of them (after a rollback).

Consistency

The data modified by the transaction is in a consistent state before and after a transaction. The meaning what is consistent is depending on the application.

Isolation

The concept of isolation means that the intermediate (possibly inconsistent) state of a transaction is invisible to other transactions. If this requirement is completely fulfilled the concurrent transactions appear as if they were executed one after another and therefore serialized. In a concurrent system it is not easy to fully guarantee this level of isolation. Since there is a inherent trade-off between isolation and concurrency this is usually not desirable anyway.

Durability

This property means that the modifications of a transaction are persisted once a transaction is committed. This means that the changed data is still stored after a restart or a system failure.

Next Chapter: Concepts

Clone this wiki locally