Algorithm Search⌘K

Definitionadvanced

Multiversion serializability

Also called multiversion serialization graph, MVSR, one-copy serializability of multiversion schedules.

A multiversion schedule is serializable when its reads-from relation is that of a serial run on one copy of each item. A version order with an acyclic MVSG proves it.

A multiversion schedule lets a read return an older version of an item, as multiversion concurrency control does. Multiversion serializability (MVSR) says when such a schedule is correct: it must look, to every transaction, like a serial run on a database with one copy of each item. The notion uses the reads-from relation, as view serializability does, and not the order of conflicting steps of conflict serializability, because writes of the same item no longer overwrite each other. Bernstein and Goodman (1983) called it one-copy serializability, the name also used for replicated data on the one-copy serializability page. The multiversion serialization graph (MVSG) is the tool to prove it: a schedule is MVSR if and only if some order of the versions of each item makes this graph acyclic. Testing MVSR is NP-complete, so schedulers such as multiversion timestamp ordering and snapshot isolation fix the version order in advance.

Definition

Versions. Each write wi(x)w_i(x) of transaction TiT_i makes a new version xix_i. An initial transaction T0T_0 writes the version x0x_0 of every item before the schedule starts. A multiversion schedule mm is a schedule of steps ri(xj)r_i(x_j) and wi(xi)w_i(x_i), together with commits and aborts, in which each read ri(xj)r_i(x_j) comes after wj(xj)w_j(x_j), and a transaction that has written xx reads its own version xix_i. The map from each read to the version it returns is the version function. A monoversion schedule is one where each read returns the version of the last write of the item before it; this is an ordinary schedule.

Reads-from. TiT_i reads xx from TjT_j in mm if mm contains ri(xj)r_i(x_j). Two multiversion schedules on the same transactions are view equivalent if they have the same steps and the same reads-from relation. There is no condition on final writes, because every version stays available.

MVSR. A multiversion schedule mm is multiversion serializable if its committed projection is view equivalent to a serial monoversion schedule of the same committed transactions. In the serial monoversion schedule each read returns the last version written before it in the serial order.

Version order and MVSG. A version order ≪\ll is, for each item xx, a total order on the committed versions of xx with x0x_0 first. For a schedule mm and a version order ≪\ll, the graph MVSG(m,≪)MVSG(m, \ll) has a node for each committed transaction, including T0T_0, and these arcs:

  1. Tj→TiT_j \to T_i whenever TiT_i reads xx from TjT_j, i≠ji \ne j (the reads-from arcs);
  2. for each read rk(xj)r_k(x_j) and each write wi(xi)w_i(x_i) with ii, jj, kk distinct: Ti→TjT_i \to T_j if xi≪xjx_i \ll x_j, and Tk→TiT_k \to T_i if xj≪xix_j \ll x_i (the version order arcs).

MVSG theorem (Bernstein and Goodman, 1983). A multiversion schedule is MVSR if and only if there is a version order ≪\ll such that MVSG(m,≪)MVSG(m, \ll) is acyclic. A serial order is then any topological sort of the graph.

The version order arcs say that a writer TiT_i of xx goes either before the writer TjT_j of the version that TkT_k read, or after the reader TkT_k; it cannot fall between them, since then TkT_k would read xix_i in the serial run.

Multiversion conflicts. A simpler, conflict-based class MCSR counts only the pair "ri(xj)r_i(x_j) before wk(xk)w_k(x_k)" as a conflict. Weikum and Vossen show that MCSR is strictly contained in MVSR, and that MCSR can be tested in polynomial time.

Examples and non-examples

An old version repairs a schedule. T1T_1 reads xx and yy; T2T_2 writes both.

m=r1(x0) w2(x2) w2(y2) c2 r1(y0) c1.m = r_1(x_0)\, w_2(x_2)\, w_2(y_2)\, c_2\, r_1(y_0)\, c_1.

As a monoversion schedule, r1(y)r_1(y) would read y2y_2, T1T_1 would come before T2T_2 on xx and after it on yy, and the schedule would not be serializable. With the old version y0y_0, T1T_1 reads both items from T0T_0, which is the serial schedule T0 T1 T2T_0\, T_1\, T_2. With x0≪x2x_0 \ll x_2 and y0≪y2y_0 \ll y_2, the MVSG has the reads-from arc T0→T1T_0 \to T_1 and the version order arc T1→T2T_1 \to T_2 (from r1(x0)r_1(x_0) and w2(x2)w_2(x_2), and again from r1(y0)r_1(y_0) and w2(y2)w_2(y_2)), and no cycle. A long read-only transaction under multiversion timestamp ordering or snapshot isolation behaves in this way.

Write skew is not MVSR.

m=r1(x0) r1(y0) r2(x0) r2(y0) w1(x1) w2(y2) c1 c2.m = r_1(x_0)\, r_1(y_0)\, r_2(x_0)\, r_2(y_0)\, w_1(x_1)\, w_2(y_2)\, c_1\, c_2.

In the serial order T1T2T_1 T_2, T2T_2 would read x1x_1; in T2T1T_2 T_1, T1T_1 would read y2y_2. Neither matches. In the graph, the only possible version order puts x0x_0 first, so r2(x0)r_2(x_0) and w1(x1)w_1(x_1) give T2→T1T_2 \to T_1, and r1(y0)r_1(y_0) and w2(y2)w_2(y_2) give T1→T2T_1 \to T_2: a cycle for every version order. Snapshot isolation allows this schedule; it is the write skew.

The version order matters. In m=w1(x1) c1 w2(x2) c2 r3(x1) c3m = w_1(x_1)\, c_1\, w_2(x_2)\, c_2\, r_3(x_1)\, c_3, the order x0≪x1≪x2x_0 \ll x_1 \ll x_2 gives the arcs T1→T3T_1 \to T_3 and, from r3(x1)r_3(x_1) and w2(x2)w_2(x_2), T3→T2T_3 \to T_2: the serial order is T1 T3 T2T_1\, T_3\, T_2, so mm is MVSR. The order x0≪x2≪x1x_0 \ll x_2 \ll x_1 also gives an acyclic graph, with the serial order T2 T1 T3T_2\, T_1\, T_3. Read as a monoversion schedule, r3(x)r_3(x) would return x2x_2 and not x1x_1, so the multiversion schedule has a reads-from relation that no monoversion schedule with the same step order has.

Monoversion schedules. A view serializable monoversion schedule is MVSR with its own version function, so VSR is contained in MVSR. The containment is strict, as the first example shows.

Not MVSR, for every version order. m=r1(x0) w2(x2) c2 r1(x2) c1m = r_1(x_0)\, w_2(x_2)\, c_2\, r_1(x_2)\, c_1 reads two different versions of xx in one transaction with no write of T1T_1 between. Before T2T_2 in the serial order, T1T_1 reads x0x_0 twice; after it, T1T_1 reads x2x_2 twice. Neither matches, so mm is not MVSR.

References

  1. Philip A. Bernstein and Nathan Goodman, Multiversion concurrency control, theory and algorithms, ACM Transactions on Database Systems 8(4), 1983, pages 465 to 483, the definitions of multiversion histories and one-copy serializability, and the multiversion serialization graph theorem
  2. Christos H. Papadimitriou and Paris C. Kanellakis, On concurrency control by multiple versions, ACM Transactions on Database Systems 9(1), 1984, pages 89 to 99, the NP-completeness of testing multiversion serializability, chapter level only
  3. Philip A. Bernstein, Vassos Hadzilacos and Nathan Goodman, Concurrency Control and Recovery in Database Systems, Addison-Wesley, 1987, Chapter 5, Multiversion Concurrency Control (multiversion histories, one-copy serializability and the MVSG theorem)
  4. Gerhard Weikum and Gottfried Vossen, Transactional Information Systems, Morgan Kaufmann, 2001, Chapter 5, Multiversion Concurrency Control (the classes MVSR and MCSR, VSR inside MVSR, and the NP-completeness of MVSR)

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.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/7MFAKN/text.yaml