160 likes | 299 Views
Serializable Isolation for Snapshot Databases by Cahill, R öhm , and Fekete. Presented by Dr. Greg Speegle. Snapshot isolation ( sI ). Concurrency Control Multiple Versions Version number timestamp of writing transaction Read last committed value Ex. w0(x)c0R1(x)W1(x)R2(x)
E N D
Serializable Isolation for Snapshot Databases byCahill, Röhm, and Fekete Presented by Dr. Greg Speegle
Snapshot isolation (sI) • Concurrency Control • Multiple Versions • Version number timestamp of writing transaction • Read last committed value • Ex. w0(x)c0R1(x)W1(x)R2(x) • First committer wins • Ex. w0(x)c0R1(x)W1(x)R2(x)W2(x)c2c1 => abort T1 • rw conflicts • Ti reads x concurrent with Tj writes x • Popular in commercial databases
SI vs 2pl • Lower overhead • No read locks • No blocking between reads and writes • Ex: R1(x)R2(x)W1(x) • Non-serializable schedules allowed • R1(x)R1(y)R2(x)R2(y)W1(x)W2(y)c1c2 • R1(y) < W2(y) => T1->T2 • R2(x) < W1(x) => T2->T1 • Write skew
Serializable isolation for shanpshot databases • Performance better than 2PL • Correctness better than SI
Protocol - Basics • SI plus • Booleans InConflict and OutConflict for every transaction • SIRead locks • Does not block writes • Does not block on writes • Indicate rw-conflicts
Protocol – Read by t1 • Request SIRead Lock • Write lock held by T2 => T1.InConflict = true & T2.OutConflict = true • For all versions (Ti) later than version read by T1 • T1.InConflict = True • Ti.OutConflict = True • Continue as in SI
Protocol – Write by t1 • Request Write Lock (in SI) • SIREAD lock by T2 • T1.OutConflict = true • T2.InConflict = true • Create new version with timestamp T1 • Continue as in SI
Protocol – Commit by t1 • T1.InConflict && T1.OutConflict => abort • Otherwise, same as SI
Example Execution • R1(x)R1(y)R2(x)R2(y)W1(x)W2(y) • W1(x) sets T2.InConflict & T1.OutConflict • W2(y) sets T2.OutConflict & T1.InConflict • Commit request causes abort
Example execution 2 • R1(x)R1(y)R2(x)R2(y)W1(x)c1W2(y) • SIREAD by T1 released at c1 problem • T2.OutConflict not set • Maintain locks past commit • Release when all concurrent transaction terminated
All Schedules serializable • Assume Not: Cyclic SG and follow protocol • All ww/wr conflicts => commit cycle • One rw conflict • WLOG Tn -> T0 is rw • T0 commits before Tn-1 commits, before Tn starts => rw not possible • Two consecutive rw conflict • InConflict && OutConflict
All Schedules Serializable • Two non-consecutive rw conflicts (to appear paper) • WLOG, Tn->T0 & Ti->Tj • T0 & Tnconcurrent, Ti & Tj concurrent • Path from T0 to Ti and Tj to Tn non-rw conflicts • T0 commits before Ti starts • Tj commits before Tn starts • Ti and Tj concurrent => T0 committed and Tn not started (not concurrent)
Serializable schedule rejected • Conservative scheduler • R1(x) W2(x)R3(y)W1(y)c1 • Equivalent to T3 T1 T2 • W2(x) sets T1.InConflict • W1(y) sets T1.OutConflict • Abort T1 at c1
Conclusion • Positive Theoretical Results • Excellent Performance under High Contention • Some problems under Low Contention Due to False Positives • Future Work - study increased detail to reduce false positives