1 / 42

The Serializability of Concurrent Database Updates

. The Serializability of Concurrent Database Updates. CHRISTOS H. PAPADIMITRIOU (Journal of the ACM, Volume 26, 1979) Presented by: Yuri Meshman. Contents. Transactions History (Preliminary definitions) SR is NPC (stencil of proof) Polygraph SR Subsets in P DSR The Class Q

xandy
Télécharger la présentation

The Serializability of Concurrent Database Updates

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Serializability of Concurrent Database Updates CHRISTOS H. PAPADIMITRIOU (Journal of the ACM, Volume 26, 1979) Presented by: Yuri Meshman For any comments or updates contact: syurim@gmail.com

  2. Contents • Transactions History (Preliminary definitions) • SR is NPC (stencil of proof) • Polygraph • SR Subsets in P • DSR • The Class Q • Two-Phase locking and P3 • Topography of SR, S, Q, SSR, DSR, P3 and 2PL • Restrictions on Read Write Set (when SR is in P) • Schedulers of Histories • Discussion – extension to transactions with multiple steps – not going through

  3. Contents • Transactions History (Preliminary definitions) • SR is NPC (stencil of proof) • Polygraph • SR Subsets in P • DSR • The Class Q • Two-Phase locking and P3 • Topography of SR, S, Q, SSR, DSR, P3 and 2PL • Restrictions on Read Write Set (when SR is in P) • Schedulers of Histories • Discussion – extension to transactions with multiple steps – not going through

  4. Transactions HistoryTransaction-Bank Example Central Bank Registry Lucy Ricky A B C 500 500 500 Read (A, t) t = t - 100 500 400 500 Write (A, t) Read (A, s) s = s - 100 Write (A, s) 300 500 500 Read (B, t) t = t + 100 300 600 500 Write (B, t) Read (C, s) s = s + 100 Write (C, s) 300 600 600 300 + 600 + 600 = 1500

  5. Transactions HistoryTransaction-Bank Example Central Bank Registry Lucy Ricky A B C 500 500 500 Read (A, t) t = t - 100 Read (A, s) s = s - 100 500 Write (A, s) 400 500 400 500 500 Write (A, t) Read (B, t) t = t + 100 400 600 500 Write (B, t) Read (C, s) s = s + 100 Write (C, s) 400 600 600 400 + 600 + 600 = 1600

  6. Transactions HistoryDefinition

  7. Transactions HistoryFrom Databases to Programs start F F J F J J Halt

  8. Transactions HistoryFrom Databases to Programs start F • equivalent histories if and only if • their program schemata are equivalent. • For:- Any set of domains for the variables • Any set of initial values • Any interpretation for the functions • The values of the variables are identical after the execution in both histories. F J F J J Halt

  9. Transactions HistoryHistories Equivalence Proposition 1. Two histories and are equivalentiff they have the same set of live transactions, and a live reads from in iff reads from in .

  10. Transactions HistoryHistories Equivalence Proposition 1. Two histories and are equivalentiff they have the same set of live transactions, and a live reads from in iff reads from in . Corollary. Equivalence of histories can be decided in time.

  11. Transactions HistorySerializability A history is serial if for all . immediatly precedes . A history is serializable if there is a serial history such that Notation:

  12. Contents • Transactions History • SR is NPC (stencil of proof) • Polygraph • SR Subsets in P • DSR • The Class Q • Two-Phase locking and P3 • Topography of SR, S, Q, SSR, DSR, P3 and 2PL • Restrictions on Read Write Set (when SR is in P) • Schedulers of Histories • Discussion – extension to transactions with multiple steps – not going through

  13. SR is NPCPolygraph - Introduction Definition 1. A polygraph is a digraph together with a set of bipaths, pairs of arcs – not necessarily in A – of the form such that . Alternatively, a family Dof digraphs. A digraph is in D iff , and for bipath, contains one of . v

  14. SR is NPCPolygraph- Introduction Definition 1. A polygraph is a digraph together with a set of bipaths, pairs of arcs – not necessarily in A – of the form such that . Alternatively, a family Dof digraphs. A digraph is in D iff , and for bipath, contains one of . v

  15. SR is NPCPolygraph– Acyclicity Definition 2. A polygraph is acyclic if there is an a cyclic digraph is in D. v

  16. SR is NPCTransactions Polygraph is live transactions of Given . If reads a variable from : Furthermore if is writing to :

  17. SR is NPCTransactions Polygraph Lemma 1. Two histories are equivalent iff are identical Lemma 2. is serializable iff is acyclic

  18. SR is NPCThe proof stencil Theorem 1. Testing if h is serializable is NP-complete, even if h has no dead transactions. Preliminary: 3SAT is NPC Lemma 3. 3SAT is NPC when formulas are non circular (no repeating variables) Theorem 1 proof: reduction from 3SAT to polygraph acyclicity

  19. SR is NPCConstruction of =x or

  20. SR is NPCConstruction of =x or

  21. Contents • Transactions History • SR is NPC (stencil of proof) • Polygraph • SR Subsets in P • DSR • The Class Q • Two-Phase locking and P3 • Topography of SR, S, Q, SSR, DSR, P3 and 2PL • Restrictions on Read Write Set (when SR is in P) • Schedulers of Histories • Discussion – extension to transactions with multiple steps – not going through

  22. SR Subsets in PDSR-conflict serializability Definition 3. Let , . We write if , for some , and: • for some or • , or Letbe the transitive reflexive closure of . Since is symmetric is an equivalence relation

  23. SR Subsets in PDSR-conflict serializability Proposition 2. If then is a proper subset of h is D-serializable(DSR) iff there exists a serial history h such that

  24. SR Subsets in PDSR-conflict serializability We can associate with a history h a digraph D(h) as follows: is an arc if: • and , or • and or • and Theorem 2. A history h is DSR iff D(h) is acyclic.

  25. SR Subsets in PDSR-conflict serializability Corollary 2. A history is DSR iff we can find real numbers with the following properties • and , then • and then • and Corollary 1. Checking whether a history is DSR can be done in

  26. SR Subsets in PThe class Q Definition 4. A history h is in Q if there exist non integer, distinct real numbers such that: • and , then • and

  27. SR Subsets in PThe class Q Theorem 3. If h is in Q, then h is DSR. We can associate with a history h a digraph D’(h) a super graph as follows: is an arc if: • and or • and

  28. SR Subsets in PTwo Phase locking and P3 Definition 5. h is two phase locked (iff there exist distinct non-integer real numbers (the lockpoints) s.t: • and , then • and

  29. SR Subsets in PTwo Phase locking and P3 The inclusion is proper:

  30. SR Subsets in PTwo Phase locking and P3 Definition 6. Let G(h) be an undirected graph corresponding to D(h). A cycle - s.t. is an edge - is bad if and

  31. SR Subsets in PTwo Phase locking and P3 Definition 6.(continued) is a guardian of if is part of a bad cycle in G(h). h obeys the P3 protocol () if when is a guardian of we do not have

  32. SR Subsets in PSSR Definition 7. is Serializable in the Strict Sense h if there is a serial history such that and , implies .

  33. SR Subsets in PTopography

  34. Contents • Transactions History • SR is NPC (stencil of proof) • Polygraph • SR Subsets in P • DSR • The Class Q • Two-Phase locking and P3 • Topography of SR, S, Q, SSR, DSR, P3 and 2PL • Restrictions on Read Write Set (when SR is in P) • Schedulers of Histories • Discussion – extension to transactions with multiple steps – not going through

  35. Restrictions on Read Write Set (SR is in P) Theorem 8. If for w for then is serializable iff is DSR.

  36. Restrictions on Read Write Set (SR is in P)

  37. Contents • Transactions History • SR is NPC (stencil of proof) • Polygraph • SR Subsets in P • DSR • The Class Q • Two-Phase locking and P3 • Topography of SR, S, Q, SSR, DSR, P3 and 2PL • Restrictions on Read Write Set (when SR is in P) • Schedulers of Histories • Discussion – extension to transactions with multiple steps – not going through

  38. Schedulers of Histories 2PL and P3 correspond to simple schedulers. A trivial scheduler will generate only serial histories. Scheduler task becomes interesting and important when he must transform the arriving schedule to a non equivalent output which is closest to the input. Definition 8. A schedule, for (histories), is such that

  39. Schedulers of Histories Assumptions: • works online (receiving transactions) • Optimism – doesn’t change order of transactions seen so far, if can be extended to a serializable history. efficient if computable in polynomial time. Q: Which classes of histories have efficient schedulers. Efficient scheduler if the input class is in P? No

  40. Schedulers of Histories Should be computed efficiently by proposed scheduler. Check for if the output starts with - to check SR efficiently. Efficient scheduler if the input class is in P? No

  41. Schedulers of Histories • Corollary 1. Unless P=NP, SR has no efficient scheduler. • Corollary 2. S, 2PL, P3, Q, DSR have efficient schedulers.

  42. Thank you

More Related