Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memgraph vs. Adya weak consistency #807

Merged
merged 7 commits into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion pages/fundamentals/transactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,29 @@ lowest:
described in ANSI/ISO SQL-92 standard. In order to not mess up data consistency,
this isolation level should only be used in the read-only access mode.

| Phenomenon | Description | Isolation levels that protect against observing phenomenon |
| Phenomenon | Description | Disallowed by |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| Dirty Read | Transaction reads an object that was never committed by other transaction. | SNAPSHOT ISOLATION, READ COMMITTED |
| Non-repeatable Read | Transaction reads an object twice. When the txn reads the object 2nd time, it receives the modified value because other txn modified it. | SNAPSHOT ISOLATION |
| Phantom | Transaction reads objects meeting a certain condition and then finds additional objects when reading 2nd time because another txn added new objects. | SNAPHSOT ISOLATION |


Based on [Adya's classification of phenomena](https://pmg.csail.mit.edu/papers/adya-phd.pdf), we can further write:

| Phenomenon | Disallowed by |
| ---------- | ---------------------------------------------------- |
| G0 | SNAPHSOT ISOLATION, READ COMMITTED, READ UNCOMMITTED |
| G1a | SNAPSHOT ISOLATION, READ COMMITTED |
| G1b | SNAPSHOT ISOLATION, READ COMMITTED |
| G1c | SNAPSHOT ISOLATION, READ COMMITTED |
| G1-predA | SNAPSHOT ISOLATION, READ COMMITTED |
| G1-predB | SNAPSHOT ISOLATION, READ COMMITTED |
| G_single | SNAPSHOT ISOLATION |
| G2_item | NONE |

In terms of Adya's isolation levels, Memgraph supports: PL-1, PL-MSR (Monotonic Snapshot Reads), PL-2, PL-2', PL-2'', PL-2L, PL-CS (Cursor Stability) and PL-2+ (consistent view).

You can find tests for these phenomena [here](https://github.com/memgraph/memgraph/blob/master/tests/manual/test_isolation_level.py).

To check the current isolation level run the following query:

Expand Down