Definitionadvanced
Adya's generalized isolation levels
Also called direct serialization graph, DSG isolation levels, portable isolation levels, PL-1 to PL-3.
Isolation levels defined by the cycles they forbid in a graph of dependencies between committed transactions, so that locking, optimistic and multiversion systems can all meet them.
Atul Adya's thesis (1999), and the paper of Adya, Liskov and O'Neil (2000), define isolation levels by the shapes of cycles in the direct serialization graph (DSG) of a history, a graph on the committed transactions with an arc for each write dependency, read dependency and anti-dependency. The levels of Berenson et al. (1995) forbid patterns of operations such as "a read of data that has not committed yet", and in effect assume a locking implementation; optimistic and multiversion systems that produce correct histories by other means fail those definitions. Adya's levels speak only about committed transactions and the versions they read and install, so any implementation can meet them. The graph is the multiversion serialization graph with the version order given in the history, and its cycles are the transaction anomalies. The four portable levels PL-1, PL-2, PL-2.99 and PL-3 match read uncommitted, read committed, repeatable read and serializable; the thesis adds PL-2+, the weakest level with consistent reads, and PL-SI, a definition of snapshot isolation without timestamps.
Definition
Histories. A history consists of the reads, writes, commits and aborts of the transactions, and a version order : for each object, a total order on the versions installed by committed transactions. Each write makes a version ; a read names the version it returns; a predicate read names the predicate and the set of versions, one per object, from which its matches were computed. A version of changes the matches of if matches in that version and not in the version before it in , or the other way round.
Dependencies. For committed :
- (directly write-depends) if installs and installs the next version of after in .
- (directly read-depends) if reads (an item read dependency), or if a predicate read of uses a version of equal to or later than a version that changes the matches of (a predicate read dependency).
- (directly anti-depends) if reads a version and installs the next version of after (an item anti-dependency), or if installs a version that changes the matches of a predicate read of and comes after the version that read used (a predicate anti-dependency).
DSG. has a node for each committed transaction and an arc for each of these dependencies.
Phenomena.
- G0 (write cycles): has a cycle of ww arcs only.
- G1a (aborted reads): a committed transaction reads a version written by a transaction that aborts.
- G1b (intermediate reads): a committed transaction reads a version of written by that is not the last version of that writes.
- G1c (circular information flow): has a cycle of ww and wr arcs only.
- G1 is G1a, G1b or G1c.
- G-single (single anti-dependency cycles): has a cycle with exactly one rw arc.
- G2-item (item anti-dependency cycles): has a cycle with at least one item rw arc.
- G2 (anti-dependency cycles): has a cycle with at least one rw arc.
Levels. A history is at the level if it shows none of the listed phenomena.
| level | forbids | corresponds to |
|---|---|---|
| PL-1 | G0 | read uncommitted |
| PL-2 | G1 | read committed |
| PL-2+ | G1, G-single | consistent reads, no lost updates |
| PL-2.99 | G1, G2-item | repeatable read |
| PL-3 | G1, G2 | serializable |
| PL-SI | G1, G-SI | snapshot isolation |
A history without G1 and G2 has an acyclic DSG, and is then serializable: any topological sort is a serial order, as in the MVSG theorem.
PL-SI. For snapshot isolation each committed transaction also has a start point and a commit point in one time order. The start-ordered serialization graph is plus a start-dependency arc whenever commits before starts. G-SIa (interference) holds if has a ww or wr arc from to but no start-dependency arc from to : saw or overwrote the effect of a transaction that had not committed when started. G-SIb (missed effects) holds if has a cycle with exactly one rw arc. G-SI is G-SIa or G-SIb.
Examples and non-examples
A serializable history that the broad P1 forbids. . reads data before commits, so the broad dirty read P1 of Berenson et al. rejects it at read committed. Here commits and the DSG has the single arc , so the history is PL-3. An optimistic system that lets read early and makes it wait for at commit produces exactly this.
A serializable history that the broad P2 forbids. . writes an item that read before ends, which is the broad fuzzy read P2. The DSG has one arc and no cycle, so the history is PL-3, with the serial order . A multiversion system can give it at serializable without making wait.
The lost update is PL-2 but not PL-2+. with . The arcs are ( read , and installs the next version) and . The cycle has one rw arc: G-single and G2-item, but no G1.
Write skew is PL-2+ and PL-SI but not PL-2.99. . The cycle has two item rw arcs. So it is G2-item but not G-single. With both transactions concurrent, the SSG has no start arcs and no ww or wr arcs between them, and no cycle with one rw arc, so it is PL-SI: this is the write skew of snapshot isolation.
A phantom that PL-2.99 allows. reads the employees of a department by a predicate , and then the stored count . inserts a new employee in that department, updates and commits before reads . The predicate read of used the version of before the insert, so is a predicate anti-dependency, and on . The cycle has one rw arc, which is a predicate arc: the history is not G2-item, so PL-2.99 allows it, but it is G2 and G-single, so PL-3 and PL-2+ forbid it. This is H3 of Berenson et al.
A serializable history that is not PL-SI. starts, writes and commits, then reads and commits. The serial order explains it, so it is PL-3. But has no start-dependency arc, since committed after started: G-SIa. A snapshot taken at the start of could not contain .
Related definitions
- How the levels relate. PL-1 is weaker than PL-2, and PL-3 is stronger than all others except PL-SI. PL-2+ and PL-2.99 are incomparable: write skew separates them one way and the predicate phantom above the other. PL-SI is stronger than PL-2+, since every DSG cycle with one rw arc is an SSG cycle with one rw arc, and it is incomparable with PL-3 and with PL-2.99, as write skew and the last example show.
- Isolation levels gives the levels of SQL and of Berenson et al., and the correspondence with locking.
- Multiversion serializability is the setting: the DSG is the multiversion serialization graph for the version order of the history, with its arcs split by kind.
- The dangerous structure theorem is a statement about DSG cycles under snapshot isolation: every cycle has two rw arcs in a row between concurrent transactions.
- Highly available transactions and consistency models use these phenomena to classify which levels a system can give while it stays available during network partitions.
References
- Atul Adya, Weak consistency, a generalized theory and optimistic implementations for distributed transactions, PhD thesis, MIT, 1999, the chapters on histories with version orders, the direct serialization graph, the phenomena G0 to G2 and G-single, the levels PL-1 to PL-3 with PL-2+ and PL-2.99, and the start-ordered serialization graph with PL-SI; chapter level only
- Atul Adya, Barbara Liskov and Patrick O'Neil, Generalized isolation level definitions, Proceedings of the 16th IEEE International Conference on Data Engineering (ICDE), 2000, the conference version of the definitions of the DSG, G0, G1a, G1b, G1c, G2-item and G2, and of the portable levels, chapter level only
- Hal Berenson, Phil Bernstein, Jim Gray, Jim Melton, Elizabeth O'Neil and Patrick O'Neil, A critique of ANSI SQL isolation levels, Proceedings of ACM SIGMOD 1995, the phenomena P0 to P3 in their broad form, which the generalized definitions replace
- Natacha Crooks, Youer Pu, Lorenzo Alvisi and Allen Clement, Seeing is believing, a client-centric specification of database isolation, arXiv 1609.06670, the restatement of Adya's definitions, used to compare them with state-based definitions, chapter level only
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag C7AQN1 Edit this page History Report an error Markdown