1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 7: View-Serializable Schedules Professor Chen Li.

Slides:



Advertisements
Similar presentations
1 Shivnath Babu Concurrency Control (II) CS216: Data-Intensive Computing Systems.
Advertisements

Cs4432concurrency control1 CS4432: Database Systems II Lecture #21 Concurrency Control : Theory Professor Elke A. Rundensteiner.
CS 277: Database System Implementation Notes 11: View Serializability
Database Systems (資料庫系統)
More About Transaction Management Chapter 10. Contents Transactions that Read Uncommitted Data View Serializability Resolving Deadlocks Distributed Databases.
Conflict Serializability Example Murat Kantarcioglu.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
Introduction to Database Systems1 Concurrency Control CC.Lecture 1.
1 Lecture 10: Transactions. 2 The Setting uDatabase systems are normally being accessed by many users or processes at the same time. wBoth queries and.
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Database System Principles 18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115.
Chapter 15: Transactions Transaction Concept Transaction Concept Concurrent Executions Concurrent Executions Serializability Serializability Testing for.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control Professor Elke A. Rundensteiner.
Concurrency Control II
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 2: Enforcing Serializable Schedules Professor Chen Li.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #23 Concurrency Control Professor Elke A. Rundensteiner.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control: Locking-based Protocols Professor Elke A. Rundensteiner.
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 4: More on Locks Professor Chen Li.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
Lecture 12 Transactions: Isolation. Transactions What’s hard? – ACID – Concurrency control – Recovery.
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 5: Tree-based Concurrency Control and Validation Currency Control Professor.
Kyoung-Hwan Yun (#110). Conflicts Precedence Graphs and a Test for Conflict- Serializability.
1 CS216 Advanced Database Systems Shivnath Babu Notes 11: Concurrency Control.
Prob.1 CSE 255 Query Optimization Problem  CustomerName (  BranchName=‘Storrs’^ Balance > 1000 ( Branch x Account x Depositor))  Consider the Three.
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 6: Cascading Rollbacks, Deadlocks, and Long Transactions Professor Chen Li.
CS4432: Database Systems II Lecture #26 Concurrency Control and Recovery Professor Elke A. Rundensteiner.
Sekolah Tinggi Ilmu Statistik (STIS) 1 Dr. Said Mirza Pahlevi, M.Eng.
Conflict-Serializability Bharath Kumar Manur Venkataramana Class ID No:- 110.
Concurrent Transactions Even when there is no “failure,” several transactions can interact to turn a consistent state into an inconsistent state.
Concurrency. Busy, busy, busy... In production environments, it is unlikely that we can limit our system to just one user at a time. – Consequently, it.
Transactions or Concurrency Control. Introduction A program which operates on a DB performs 2 kinds of operations: –Access to the Database (Read/Write)
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
CS4432transaction management1 CS4432: Database Systems II Lecture #23 Transaction Management Professor Elke A. Rundensteiner.
1 Concurrency Control. 2 Transactions A transaction is a list of actions. The actions are reads (written R T (O)) and writes (written W T (O)) of database.
Cs4432concurrency control1 CS4432: Database Systems II Concurrency Control.
Copyright © 2004 Pearson Education, Inc.. Chapter 17 Introduction to Transaction Processing Concepts and Theory.
Chapter 181 Chapter 18: Concurrency Control (Slides by Hector Garcia-Molina,
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control: Locking-based Protocols Professor Elke A. Rundensteiner.
TRANSACTIONS. Objectives Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation Transaction.
Formal-Concurrency-Control General Comments Information needed by Concurrency Controllers –Locks on database objects (System-R, Ingres, Rosenkrantz…) –Time.
1 Concurrency Control II: Locking and Isolation Levels.
Chapter 14 Transactions Yonsei University 1 st Semester, 2015 Sanghyun Park.
1 CS542 Concurrency Control: Theory and Protocol Professor Elke A. Rundensteiner.
Concurrency (cont.) Schedule. In multiprogramming environment, Several transaction run concurrently Database consistency can be destroy Schedules to ensure.
1 Controlled concurrency Now we start looking at what kind of concurrency we should allow We first look at uncontrolled concurrency and see what happens.
Jinze Liu. ACID Atomicity: TX’s are either completely done or not done at all Consistency: TX’s should leave the database in a consistent state Isolation:
6/18/2016Transactional Information Systems3-1 Part II: Concurrency Control 3 Concurrency Control: Notions of Correctness for the Page Model 4 Concurrency.
Concurrency Control.
CS216: Data-Intensive Computing Systems
Database Management System
Schedules and Serializability
General Comments Information needed by Concurrency Controllers
March 21st – Transactions
Temple University – CIS Dept. CIS661 – Principles of Data Management
Concurrency Control 11/22/2018.
Algorithm 2 Algorithm 2 Problem
Distributed Transactions
Transactions Sylvia Huang CS 157B.
Lecture 21: Concurrency & Locking
Conflict-Serializability (section 18.2 of Concurrency Control)
6.830 Lecture 12 Transactions: Isolation
Autumn 2015 Lecture 10 Minimum Spanning Trees
Conflicts.
Lecture 22: Intro to Transactions & Logging IV
Additional Example 2: Graphing Ordered Pairs Graph and label each point on a coordinate grid. A. L (3, 5) Start at (0, 0)
Transaction management
Autumn 2016 Lecture 10 Minimum Spanning Trees
C. Faloutsos Transactions
Temple University – CIS Dept. CIS616– Principles of Data Management
Transaction Serializability
Presentation transcript:

1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 7: View-Serializable Schedules Professor Chen Li

ICS214BNotes 072 View Serializability Conflict equivalentView equivalent Conflict serializableView serializable

ICS214BNotes 073 Motivating example Schedule Q T 1 T 2 T 3 Read(A) Write(A)

ICS214BNotes 074 Same as Q = r 1 (A) w 2 (A) w 1 (A) w 3 (A) P(Q): T 1 T 2 T 3  Not conflict serializable!

ICS214BNotes 075 But now compare Q to Ss, a serial schedule: QT 1 T 2 T 3 Read(A) Write(A) Write(A) Write(A) SsT 1 T 2 T 3 Read(A) Write(A) Write(A) Write(A)

ICS214BNotes 076 T 1 reads same thing in Q, Ss T 2, T 3 read same thing (nothing?) After Q or Ss, DB is left in same state  So what is wrong with Q?

ICS214BNotes 077 Definition Schedules S 1,S 2 are View Equivalent if: (1) If in S 1: w j (A)  r i (A) then in S 2: w j (A)  r i (A) (2) If in S 1: r i (A) reads initial DB value, then in S 2: r i (A) also reads initial DB value (3) If in S 1: T i does last write on A, then in S 2: T i also does last write on A  means “reads value produced”

ICS214BNotes 078 Definition Schedule S 1 is View Serializable if it is view equivalent to some serial schedule

ICS214BNotes 079 View Conflict Serializable ? View Serializable  Conflict Serializable e.g., See Schedule Q Conflict Serializable  View Serializable ?

ICS214BNotes 0710 Lemma Conflict Serializable  View Serializable Proof: Swapping non-conflicting actions does not change what transactions read nor final DB state

ICS214BNotes 0711 Diagram All schedules View Serializable Conflict Serializable

ICS214BNotes 0712 Note: All view serializable schedules that are not conflict serializable, involve useless write S = W 2 (A) … W 3 (A)….. no reads

ICS214BNotes 0713 How do we test for view-serializability?  P(S) not good enough… (see schedule Q)

ICS214BNotes 0714 One problem: some swaps involving conflicting actions are OK… e.g.: S = ….w 2 (A)……r 1 (A).... w 3 (A)… w 4 (A) this action can move if w4(A) exists

ICS214BNotes 0715 Another problem: useless writes S = …..W 2 (A)…….. W 1 (A)….. no A reads

ICS214BNotes 0716 To check if S is View Serializable Polygraph: (1) Add final transaction T f that reads all DB (eliminates condition 3 of V-S definition) E.g.: S = …..W 1 (A)…….. W 2 (A)… r f (A) Last A write ? add

ICS214BNotes 0717 (2) Add initial transaction T b that writes all DB (eliminates condition 2 of V-S definition) E.g.: S = w b (A)... r 1 (A) … w 2 (A) … add ?

ICS214BNotes 0718 (3) Create labeled precedence graph of S: (3a) If w i (A)  r j (A) in S, add T i  T j 0

ICS214BNotes 0719 (3b) For each w i (A)  r j (A) do consider each w k (A): [T k  T b ] - If T i  T b  T j  T f then insert T k  T isome new p T j  T k - If T i =T b  T j  T f then insert T j  T k - If T i  T b  T j =T f then insert T k  T i p p 0 0

ICS214BNotes 0720 (4) Check if LP(S) is “acyclic” (if so, S is V-S) - For each pair of “p” arcs (p  0), choose one

ICS214BNotes 0721 Example: check if Q is V-S: Q = r 1 (A) w 2 (A) w 1 (A) w 3 (A) Q’ = w b (A) r 1 (A) w 2 (A) w 1 (A) w 3 (A) r f (A) T3T3 T2T2 T1T1 TfTf TbTb   rule 3(a) rule 3(b) 0 0 LP(S) acyclic!! S is V-S

ICS214BNotes 0722 Another example: Z=w b (A) r 1 (A) w 2 (A) r 3 (A) w 1 (A) w 3 (A) r f (A) T3T3 T2T2 T1T1 TfTf TbTb    do not pick this one of “1” pair LP(Z) acyclic, so Z is V-S (equivalent to T b T 1 T 2 T 3 T f ) S s =w b (A)r 1 (A)w 1 (A)w 2 (A)r 3 (A)w 3 (A)r f (A)

ICS214BNotes 0723 Checking view serializability is expensive Still, V-S useful in some cases...

ICS214BNotes 0724 Example on useless transactions: S = w 1 (A) r 2 (A) w 2 (B) r 1 (B) w 3 (A) w 3 (B) T b w 1 (A)  r 2 (A)w 2 (B)  r 1 (B) w 3 (A)w 3 (B)  T f 0 S’ = T3T3 T2T2 T1T1 TfTf TbTb 0 0

ICS214BNotes 0725 If we only care about final state –remove T 1, T 2 –I.e., remove useless transactions If we care what T 1, T 2 read (view equivalence), then do not remove useless transactions