GionJh
GionJh

Reputation: 2894

Precedence graphs for transactions and MVCC databases

I am trying to understand if and how precedence graphs can also be used to study the serializability of transactions in MVCC systems.

I did not manage to find much information, but this CockRoach docs page has some hints though, and it mentions that:

It is a very important observation that an rw dependency is the only dependency that can occur between concurrent transactions in Snapshot Isolation.
This is because If a ww dependency occurred, it means the two transactions had intersecting write sets, which is not possible between concurrent Snapshot transactions.
If a wr dependency occurred, for the later transaction to view the former’s writes, it can’t have begun before the former had committed.

I have some trouble to grasp what is being suggested here, especially the part:

If a ww dependency occurred, it means the two transactions had intersecting write sets, which is not possible between concurrent Snapshot transactions.

Can anyone help me understand this and also to point me in the direction of some books and articles where this may be better explained into more details ?

Upvotes: 0

Views: 61

Answers (1)

Asantamaura
Asantamaura

Reputation: 56

If a ww dependency occurred, it means the two transactions had intersecting write sets, which is not possible between concurrent Snapshot transactions.

The phrasing of this explanation is a bit strange but what it comes down to is that in snapshot (and serializable) isolation a ww dependency can't occur because the system is able to detect that a previous statement (such as the result of a SELECT statement) is no longer true/the same as it was previously due to another concurrent transaction which prevents the write from being committed.

See https://www.cockroachlabs.com/docs/v22.1/demo-serializable.html for a hands-on example (this doc also has links to other documentation explaining transaction isolation).

Upvotes: 1

Related Questions