Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 12 Transactions: Isolation. Transactions What’s hard? – ACID – Concurrency control – Recovery.

Similar presentations


Presentation on theme: "Lecture 12 Transactions: Isolation. Transactions What’s hard? – ACID – Concurrency control – Recovery."— Presentation transcript:

1 Lecture 12 Transactions: Isolation

2 Transactions What’s hard? – ACID – Concurrency control – Recovery

3 View Serializability A particular ordering of instructions in a schedule S is view equivalent to a serial ordering S' iff: Every value read in S is the same value that was read by the same read in S'. The final write of every object is done by the same transaction T in S and S'

4 Conflict Serializability A schedule is conflict serializable if it is possible to swap non-conflicting operations to derive a serial schedule. For all pairs of conflicting operations {O1 in T1, O2 in T2} either O1 always precedes O2, or O2 always precedes O1.

5 Precedence Graph Given transactions Ti and Tj, Create an edge from Ti  Tj if: Ti reads/writes some A before Tj writes A, or Ti writes some A before Tj reads A If there are cycles in this graph, schedule is not conflict serializable

6 Study Break: Serializable Transactions AB Is this schedule conflict serializable? Draw precedence graph. Is it view serializable? T1 R1 R3 W1 W3 T2 W4 W2 R4 R2 T3 R2 R1 W3 T1 R2 W4 W2 R1 T2 R2 W2 R1 W1

7 Rigorous Two Phase Locking Protocol Before every read, acquire a shared lock Before every write, acquire an exclusive lock (or "upgrade") a shared to an exclusive lock Release locks only after the transaction commits Ensures cascadeless-ness, and that commit order = serialization order

8 Study Break: 2-Phase Locking Show the locks for the following schedule: T1 R1 W1 R2 W2 T2 R2 W2 Is this a valid 2PL schedule?

9 Study Break: 2-Phase Locking Solution Show the locks for the following schedule: T1 R1 W1 R2 W2 T2 R2 W2 T1 S1 X1 S2 X2 T2 S2 X2 ===Commit Is this a valid 2PL schedule? Yes.

10 ACID, In Implementation Source:


Download ppt "Lecture 12 Transactions: Isolation. Transactions What’s hard? – ACID – Concurrency control – Recovery."

Similar presentations


Ads by Google