Mon, Nov 8, 1999 ------------------------ - Return Homework - Back to 2PL - Introduction to "U" locks - look like "S" when you get them - only can be later upgraded and used as an "X" - Introduction to "I" locks - satisfy commutativity - Compatibility Matrices - for S and X locks - for S, X and U locks (assymmetric) - for S, X, U and I locks - Example of inserting l and u operations - for S and X locks : Two ways: - Insert S before all reads and X before all writes - Insert S before all reads not followed by a write Insert X before all reads followed by a write Insert X before all writes - for S, X and U locks - Insert S before all reads not followed by a write Insert U before all reads followed by a write Insert X before all writes Wed, Nov 10, 1999 ------------------------ - How to look at compatibility matrices and tell if one lock mode completely dominates another - S and X locks: X dominates S - S, X and U locks: U dominates S, X dominates S and U - The Three Aspects of a Transaction Scheduler - Scheduler I: Inserts l and u operations - Scheduler II: Makes some Txs wait if they cannot proceed, maintain lock data structures - Scheduler III: Check for special conditions - Example of how a lock data structure looks like - Locking a Hierarchy of DB Elements - IS and IX locks - Compatibility matrix for IS, IX, S, X locks - notice that neither of S and IX dominates the other - Solution: Introduce a new lock mode "SIX" - SIX row/column contains the intersections of S and IX row/column - What is the use of SIX? - can be viewed as a computational artifact that is an intermediary for two lock modes - is useful in its own right: you might need to change one particular tuple after looking at the whole relation first (SIX mode) - Final Compatibility Matrix IS IX S X SIX -------------------------- IS y y y n y IX y y n n n S y n y n n X n n n n n SIX y n n n n - Notice that SIX is not compatible with SIX - To get IS or S -> must have on all ancestors: IS or IX - To get IX, SIX or X -> must have on all ancestors: IX or SIX - Problems with locking hierarchies: The Phantom Menace - Solution to Phantom Menace - View Adding New Tuples an "X" on the whole relation Fri, Nov 12, 1999 ------------------------ - So, far we have dealt with concurrency control - satisfies I - How do you detect deadlocks? - Who deals with A&D? - Recovery - Who deals with C? - Active and Rule-Based Elements - Basics of Recovery - Commit - Abort - Why would we need to abort? - when deadlock happens - or some other irreversible situation, like divide by zero - For ensuring A: UNDO Operation - For ensuring D: REDO Operation - UNDO Policies - STEAL vs. NO-STEAL - REDO Policies - FORCE vs. NO-FORCE - Easiest to Implement - NO-STEAL/FORCE - In real life - STEAL/NO-FORCE - First modeled in the ARIES Recovery Manager - WAL: Write-Ahead Logging: One implementation of STEAL/NO-FORCE - OLTP Benchmarks - Active and Rule-Based Elements - ECA paradigm - Limitations of ACID Model