Formal-Concurrency-Control General Comments Information needed by Concurrency Controllers –Locks on database objects (System-R, Ingres, Rosenkrantz…) –Time.

Slides:



Advertisements
Similar presentations
Serializability in Multidatabases Ramon Lawrence Dept. of Computer Science
Advertisements

Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
1 Concurrency Control III Dead Lock Time Stamp Ordering Validation Scheme.
Database Systems (資料庫系統)
More About Transaction Management Chapter 10. Contents Transactions that Read Uncommitted Data View Serializability Resolving Deadlocks Distributed Databases.
Unit 9 Concurrency Control. 9-2 Wei-Pang Yang, Information Management, NDHU Content  9.1 Introduction  9.2 Locking Technique  9.3 Optimistic Concurrency.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
1 Part V: Transactions, Concurrency control, Scheduling, and Recovery.
Concurrency Control II
Cs4432concurrency control1 CS4432: Database Systems II Lecture #23 Concurrency Control Professor Elke A. Rundensteiner.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
Topic 6.3: Transactions and Concurrency Control Hari Uday.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. –Because disk accesses are.
Quick Review of Apr 29 material
ICS 421 Spring 2010 Transactions & Concurrency Control (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Concurrency Control and Recovery In real life: users access the database concurrently, and systems crash. Concurrent access to the database also improves.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Transaction Management and Concurrency Control
1 Concurrency Control and Recovery Module 6, Lecture 1.
Optimistic CC Performance Evaluation Criterion 1. Degree of Concurrency Less reshuffle  High degree of concurrency 2. Resources used to recognize - Lock.
Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
Transaction Processing: Concurrency and Serializability 10/4/05.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 18.
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
TRANSACTIONS. Objectives Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation Transaction.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Lecture 21 Ramakrishnan - Chapter 18.
Database Systems/COMP4910/Spring05/Melikyan1 Transaction Management Overview Unit 2 Chapter 16.
Replicated Databases. Reading Textbook: Ch.13 Textbook: Ch.13 FarkasCSCE Spring
1 Concurrency Control II: Locking and Isolation Levels.
Transactions. What is it? Transaction - a logical unit of database processing Motivation - want consistent change of state in data Transactions developed.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Distributed synchronization and mutual exclusion Distributed Transactions.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Optimistic Methods for Concurrency Control By: H.T. Kung and John Robinson Presented by: Frederick Ramirez.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Transaction Management and Recovery, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 18.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Distributed Transactions What is a transaction? (A sequence of server operations that must be carried out atomically ) ACID properties - what are these.
MULTIUSER DATABASES : Concurrency and Transaction Management.
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
Part- A Transaction Management
Transaction Management
General Comments Information needed by Concurrency Controllers
Transactions.
Outline Introduction Background Distributed DBMS Architecture
Transaction Management
Concurrency.
Chapter 10 Transaction Management and Concurrency Control
Transaction management
Transaction Management
Transaction Management Overview
Temple University – CIS Dept. CIS616– Principles of Data Management
UNIT -IV Transaction.
Distributed Optimistic Algorithm
Optimistic CC Performance
Outline Introduction Background Distributed DBMS Architecture
Outline Introduction Background Distributed DBMS Architecture
Transactions, Properties of Transactions
Presentation transcript:

Formal-Concurrency-Control General Comments Information needed by Concurrency Controllers –Locks on database objects (System-R, Ingres, Rosenkrantz…) –Time stamps on database objects (Thomsa, Reed) –Time stamps on transactions (Kung, SDD-1, Schlageter, Bhargava…) Observations –Time stamps mechanisms more fundamental than locking –Time stamps carry more information –Checking locks costs less than checking time stamps

Formal-Concurrency-Control General Comments (cont.) When to synchronize –First access to an object (Locking, pessimistic validation) –At each access (question of granularity) –After all accesses and before commitment (optimistic validation) Fundamental notions –Rollback –Identification of useless transactions –Delaying commit point –Semantics of transactions

Formal-Concurrency-Control Definition: A dynamic conflict graph (DCG) for a history H = is a diagraph where V is the set of vertices representing T, the set of transactions; E is the set of edges where is an edge if and only if there exist conflicting atomic operations  j,  j for which  (  1 )<  (  j ). Lemma: The DCG of a serial history is acyclic. Theorem: A history is in DCP if and only if the DCG of H is acyclic. Theorem: In a two-step transaction model (all reads for a transaction precede all writes) whenever there is a transaction rollback in the optimistic approach due to failure in validation. There will be a deadlock in the locking approach and will cause a transaction rollback.

Formal-Concurrency-Control Basic Terms Database Database entity Distributed database Program Transaction, read set, write set Actions atomic Concurrent processing Conflict Consistency Mutual consistency History Serializability Serial history

Formal-Concurrency-Control Serializable history Concurrency control Centralized control Distributed control Scheduler Locking Read lock, write lock Two phase locking, lock point Live lock Dead lock Conflict graph Timestamp Version number Rollback Validation commit

Formal-Concurrency-Control Optimistic approach Majority voting Transaction class Crash Node failure Network partition Log Redo log Undo log Recovery abort

Formal-Concurrency-Control Concurrency Control Interleaved execution of a set of transactions that satisfies given consistency constraints. Concurrency Control Mechanisms: Locking (two-phase locking) Conflict graphs (SDD-1) Knowledge about incoming transactions or transaction typing Optimistic Requires validation (backout and starvation) Some Examples: Centralized locking Distributed locking Majority voting Local and centralized validation

Formal-Concurrency-Control Locking Problem Maintenance Deadlock Pessimistic Necessary in worst case Advantage Do not have to worry about type of consistency constraint Centralized Locking Problem Crash of central Node CongestionLess parallelism Advantage Simple and requires low overhead Distributed Locking Problem Lock management (not possible in some cases) Advantage More concurrency

Formal-Concurrency-Control Locking Protocols 1.Maintenance 2.Deadlock and livelock 3.Congested (often accessed) node 4.Crashes and release of locks 5.Pessimistic 6.Necessary in the worst case

Formal-Concurrency-Control Conflict-Graph Analysis Back out Validation Track hole lists Needs knowledge about incoming transactions (access patterns) not possible in many cases. Optimistic

Formal-Concurrency-Control Conflict Two atomic opns  i and  j conflict if: 1. They belong to different transactions. 2. Both access the same entity. 3. At least one of them is a WRITE OPN. R-W conflict W-R conflict W-W conflict Conflict preserving exchange in a history  1  i  2  2   1  1  1  2 (if  1,  2 do not conflict)

Formal-Concurrency-Control Definition: A Dynamic Conflict Graph (DCG) for a history H = is a diagraph where V is the set of vertices representing T, the set of transactions; E is the set of edges where is an edge if and only if there exist conflicting atomic operations  J,  J for which  (  I ) <  (  J ). Lemma: The DCG of a serial history is acyclic. Theorem: A history is in DCP if an only if the DCG of H is acyclic.

Formal-Concurrency-Control Restriction on the Read-Write sets S(W i )  S(R i ) for i = 1….  SR  DSR SSR  O Multi-step transactions Interpreted transactions Distributed databases

Formal-Concurrency-Control Start Read, Compute, And Write Local Semi-Commit On Initiating Site Integrity Control & Local Validation Integrity Control & Local Validation Commit, Global Write Finish Fail Success Fail Success Figure: States of a Transaction

Formal-Concurrency-Control Committed Transactions Semi-Committed Transactions Transactions Still Reading/Computing Validating Transactions Figure: Transaction Types on a Site

Formal-Concurrency-Control S(R I ) S(W I ) S(R J ) S(W J ) TITI TJTJ S(R I )  S(W J )  ø AND  (R I ) <  (W J )  T I → T J Locking R I R J W I W J Optimistic R I R J W I W J R I R J W J W I

Formal-Concurrency-Control S H SR DSR O 2PL SSR Degree of concurrency provided by different classes of histories

Formal-Concurrency-Control Distributed Database Systems Computer network (communication system) Database systems Users (programs, transactions) Examples:Issues: Distributed INGRES Correct processing (serializability) SDD-1 Consistency of databases (integrity, commitment) System R* Resiliency to failures SIRIUS – DELTA Performance (response time, throughput) RAID Communication delay

Formal-Concurrency-Control Computer Networks:Communications: Ethernet UDP/IP ATM TCP/IP FDDI ISO ARPANET BITNET NSF NET … Database Systems:User Interaction: INGRES SOL DB2 Transaction RAID

Formal-Concurrency-Control Definition 1: A history is a quadruple h = (n, , M, S) where n is a positive integer,  is a permutation of the set  n = {R 1, W 1, R 2, W 2,…,R , W  equivalently a one-to-one function  :   -> {1,2,-----,2n} that  (R i ) <  (W i ) for i = 1,2,--n, M is a finite set of variables representing physical data items, S is a function mapping  n to 2 M Set of all histories is denoted by M. Definition 2:A transaction Ti is a pair (Ri, Wi). A transaction is a single execution of a program. This program may be a simple query statement expressed in a query language. Definition 3:Read set of Ti is denoted by S (Ri) and Write set of Ti is denoted by S(Wi).

Formal-Concurrency-Control Definition 4: A history h = (n, , M, S) is serial if  (Wi) =  (Ri) + 1 for all i = 1,2,---n. In other words, a history is serial if Ri immediately precedes Wi in it for I = 1,2---n. Definition 5:A history is serializable if there is some serial history hs such that the effect of the execution of h is equivalent to hs. Note serializability requires only that there exists some serial order equivalent to the actual interleaved execution history. There may in fact be several such equivalent serial orderings. Definition 6:A history h is strongly serializable if in hs the following conditions hold true: a) (Wi) =  (Ri) + 1 b) (Ri + 1) =  (Wi) + 1 If ti + 1 is the next transaction that arrived and obtained the next time-stamp after Ti. In strongly serializable history, the following constraint must hold “If a transaction Ti is issued before a transaction Tj, then the total effect on the database should be equivalent to the effect that Ti was executed before Tj. Note if Ti and Tj are independent, e.g., {S(Ri)  S(Wi)}  {S(Rj) U S(Wj)} = ø then the effect of execution TiTj or TjTi will be the same.

Formal-Concurrency-Control history Live transaction (set can be found in O(n · |V|). Two histories are equivalent (  ) if they have the same set of live transactions. Equivalence can be determined O(n · |V| ). Theorem: Testing whether a history h is serializable is NP-complete even if h has no dead transactions. - Polygraph: Pair of arcs between nodes - Satisfiability: Problem of Boolean formulas in conjuctive normal forms with two-/three literals (SAT) (Non-circular)

Formal-Concurrency-Control Concentration of histories: same true for Ri

Formal-Concurrency-Control Two-phase locking: is 2PL If distinct non-integer real numbers (a) (b) (c) If & & for i = …

Formal-Concurrency-Control Definition G2PL: A history h is in the global two-phase locking (G2PL) class iff there exists a set of global lock points {Li | I in T} such that for transactions I and j (i) Pi (