Conflicts.

Slides:



Advertisements
Similar presentations
Cs4432concurrency control1 CS4432: Database Systems II Lecture #21 Concurrency Control : Theory Professor Elke A. Rundensteiner.
Advertisements

CS 277: Database System Implementation Notes 11: View Serializability
Database Systems (資料庫系統)
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.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control Professor Elke A. Rundensteiner.
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.
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.
Kyoung-Hwan Yun (#110). Conflicts Precedence Graphs and a Test for Conflict- Serializability.
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 7: View-Serializable Schedules Professor Chen Li.
1 CS216 Advanced Database Systems Shivnath Babu Notes 11: Concurrency Control.
CS4432: Database Systems II Lecture #26 Concurrency Control and Recovery Professor Elke A. Rundensteiner.
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.
ICS 421 Spring 2010 Transactions & Concurrency Control (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Conflict-Serializability (section 18.2 of Concurrency Control) - Amith KC Student ID –
CONCURRENCY CONTROL 18.1 Serial and Serializable Schedule By: Nitin Mathur Id: 110 CS: 257.
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.
Transaction Processing: Concurrency and Serializability 10/4/05.
Transactions or Concurrency Control. Introduction A program which operates on a DB performs 2 kinds of operations: –Access to the Database (Read/Write)
Transactions. Definitions Transaction (program): A series of Read/Write operations on items in a Database. Example: Transaction 1 Read(C) Read(A) Write(A)
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
Concurrency Control 18.1 – 18.2 Chiu Luk CS257 Database Systems Principles Spring 2009.
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.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control: Locking-based Protocols Professor Elke A. Rundensteiner.
CS411 Database Systems Kazuhiro Minami 14: Concurrency Control.
Concurrency control In production environments, it is unlikely that we can limit our system to just one user at a time. – Consequently, it is possible.
Transactions. What is it? Transaction - a logical unit of database processing Motivation - want consistent change of state in data Transactions developed.
1 CS542 Concurrency Control: Theory and Protocol Professor Elke A. Rundensteiner.
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
1 Database Systems ( 資料庫系統 ) December 27, 2004 Chapter 17 By Hao-hua Chu ( 朱浩華 )
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:
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
Concurrency Control.
Transaction Management and Concurrency
Chapter 14: Transactions
1 Introduction to Transaction Processing (1)
Database Systems II Concurrency Control
Chap. 3 Concurrency Control (covering 3.8 ~ 3.11)
CS216: Data-Intensive Computing Systems
Database Management System
Schedules and Serializability
Allocating Isolation Levels to Transactions by Alan Fekete
Enforcing Serializability by Locks
CSIS 7102 Spring 2004 Lecture 2 : Serializability
Transactions.
Concurrency Control via Validation
March 21st – Transactions
Transactions Sylvia Huang CS 157B.
Lecture 21: Concurrency & Locking
CS162 Operating Systems and Systems Programming Review (II)
Conflict-Serializability (section 18.2 of Concurrency Control)
6.830 Lecture 12 Transactions: Isolation
Lecture 22: Intro to Transactions & Logging IV
Transaction management
Transaction Management
CONCURRENCY CONTROL 18.1 Serial and Serializable Schedule
C. Faloutsos Transactions
Introduction to Database Systems CSE 444 Lectures 17-18: Concurrency Control November 5-7, 2007.
Locks.
UNIT -IV Transaction.
Database Systems (資料庫系統)
Lecture 18: Concurrency Control
Database Systems (資料庫系統)
Transaction Serializability
Presentation transcript:

Conflicts

How to we check if a schedule is serializable? We can look for orderings of actions that can interact. These illegal sequencing of actions are called conflicts.

Conflict ri(X); rj(Y) -- reads on different transactions A conflict occurs in a schedule if a pair of actions in a schedule such that, if their order is interchanged, then the behavior of at least one of the transactions involved can change. Simplified Notation For Schedules: ri(X) = a read operation in transaction "i" on database element "X" wj(Y) = a write operation in transaction "j" on database element "Y" Action Pairs: ri(X); rj(Y) -- reads on different transactions Never a conflict (even if X = Y) Reads can't change database state; no way to interact if swapped

Conflict More Action Pairs: ri(X); wj(Y) -- read/write on different objects and transactions Never a conflict. If the read in transaction "i" happens before the write in transaction "j", it has no effect on transaction "j". wi(X); wj(Y) -- write/write on different objects and transactions Never a conflict. Changing database element X has no bearing on changing Y

Conflict ri(X); wi(Y) -- read/write in same transaction More Action Pairs: ri(X); wi(Y) -- read/write in same transaction Conflict! Order of actions within a transaction are fixed and may not be changed. wi(X); wj(X) -- write/write on same object Conflict! Swapping the writes effects the final state of the object. Under the "no coincidences" assumption, we must assume that the two transactions are writing different values. ri(X); wj(X) -- read/write on same object Conflict! If the write changes the value of X before the read, the read will be different than if it had happened first.

Conflict-serializable Two actions, in different transactions, do not conflict (may be reordered without effect) unless: They involve the same database element, and At least one is a write. Two schedule are called conflict-equivalent if one can be transformed into the other by a sequence of non-conflicting swaps of adjacent actions. A schedule is called conflict-serializable if it is conflict-equivalent to a serializable schedule. To emphasize: All conflict-serializable schedules are serializable.

Is this schedule conflict-serializable? r1(A); w1(A); r2(A); w2(A); r1(B); w1(B); r2(B); w2(B) r1(A); w1(A); r2(A); r1(B); w2(A); w1(B); r2(B); w2(B) r1(A); w1(A); r1(B); r2(A); w2(A); w1(B); r2(B); w2(B) r1(A); w1(A); r1(B); r2(A); w1(B); w2(A); r2(B); w2(B) r1(A); w1(A); r1(B); w1(B); r2(A); w2(A); r2(B); w2(B) Yes, because we could make non-conflicting swaps until it was serialized.

How did I know what swaps to do? Magic Just Kidding If there is ever a pair of conflicting actions in a schedule, those transactions must appear in the same order in the serial schedule. We can't rearrange the order of a conflict, so it must be legal for the entire associated transactions to appear in the same order as the conflict. If we can't move the entire transaction there must be another contradictory conflict, thus it is not conflict-serializable. We can figure out the necessary order of the transactions by determining their precedence

Precedence Transaction 1 (T1) takes precedence over Transaction 2 (T2) in schedule S (written as T1 < T2), if there are actions A1 of T1 and A2 of T2, such that: A1 is ahead of A2 in S Both A1 and A2 involve the same database element, and At least one of A1 and A2 is a write action Notice that these are exactly the conditions under which we cannot swap the order of A1 and A2. Thus, A1 will appear before A2 in any schedule that is conflict-equivalent to S. As a result, a conflict- equivalent serial schedule must have T1 before T2.

d Precedence Graph The nodes of the precedence graph are the transactions of a schedule S. There is an arc from node Ti to node Tj if Ti < Tj. T1 < T2 T2 < T3 T1 < T3 T1 T3 T2

Determining Precedence S: r2(A); r1(B); w2(A); r3(A); w1(B); w3(A); r2(B); w2(B); Conflicts: r2(A); w3(A); -> T2 < T3 r1(B); w2(B); -> T1 < T2 w2(A); r3(A); -> T2 < T3 w2(A); w3(A); -> T2 < T3 w1(B); r2(B); -> T1 < T2 w1(B); w2(B); -> T1 < T2 T1 T3 T2

Precedence graphs and conflict-serializable All conflict-serializable schedules will have acyclic precedence graphs, meaning that there exists a topological order of the nodes that is a conflict-equivalent serial order. If there are cycles in the precedence graph, it means there isn't a legal order to serialize the transactions.

Is this precedence graph conflict-serializable? Yes No Depends on the order ??? T1 T3 T2 T4

Which serializations are conflict-equivalent to the precedence graph? T1; T2; T3; T4 T1; T2; T4; T3 T4; T1; T2; T3 ??? T1 T3 T2 T4