Distributed DBMSPage 10-12. 1© 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.

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.
Outline Introduction Background Distributed Database Design
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.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
Transaction Models of DDBMS Zsolt Németh Topics covered: –Transactions –Characterization of transactions –Formalization of transactions –Serializability.
Concurrency Control II
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
CSIS 7102 Spring 2004 Lecture 5 : Non-locking based concurrency control (and some more lock-based ones, too) Dr. King-Ip Lin.
Concurrency Control II. General Overview Relational model - SQL  Formal & commercial query languages Functional Dependencies Normalization Physical Design.
CSC271 Database Systems Lecture # 32.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
ICS 421 Spring 2010 Transactions & Concurrency Control (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Concurrency Control R &G - Chapter 19 Smile, it is the key that fits the lock of everybody's heart. Anthony J. D'Angelo, The College Blue Book.
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17.
Distributed Systems1 Chapter 7: Distributed Transactions Transaction concepts Centralized/Distributed Transaction Architecture Schedule concepts Locking.
Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Session - 13 CONCURRENCY CONTROL CONCURRENCY TECHNIQUE Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
Transaction Processing: Concurrency and Serializability 10/4/05.
Transaction Management
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Concurrency Control John Ortiz.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Concurrency Control in Distributed Databases
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari.
Lecture 11 Distributed Transaction Management. Concurrency Control The problem of synchronizing concurrent transactions such that the consistency of the.
Distributed DBMSSlide 1Lectured by, Jesmin Akhter, Assistant Professor, IIT, JU PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor,
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Concurrency Control in Distributed Databases Gul Sabah Arif.
Concurrency Control Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
Concurrency control. Lock-based protocols One way to ensure serializability is to require the data items be accessed in a mutually exclusive manner One.
Concurrency Control Concurrency Control By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
Assignment 3 -- Solution 1. Problem 1 H 1 : r 1 [y] r 1 [x] r 2 [x] w 1 [y] c 1 w 2 [y] c 2 H 1 is normally-strict two-phase locked: rl 1 [y] r 1 [y]
1 Concurrency Control Chapter Conflict Serializable Schedules  Two schedules are conflict equivalent if:  Involve the same actions of the same.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
1 7. Distributed Concurrency Control Chapter 11 Distributed Concurrency Control.
Concurrency Control and Reliable Commit Protocol in Distributed Database Systems Jian Jia Chen 2002/05/09 Real-time and Embedded System Lab., CSIE, National.
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
Concurrency Control Introduction Lock-Based Protocols
1 Concurrency control lock-base protocols timestamp-based protocols validation-based protocols Ioan Despi.
1 Database Systems ( 資料庫系統 ) December 27, 2004 Chapter 17 By Hao-hua Chu ( 朱浩華 )
CS 5204 Spring 99 1 Timestamps in Locking Protocols Timestamps: used to avoid deadlock. each transaction has a single timestamp. timestamps are used to.
Timestamp-based Concurrency Control
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Concurrency Control The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe, Fundamental of Database Systems, 4th edition,
Em Spatiotemporal Database Laboratory Pusan National University File Processing : Concurrency Control 2004, Spring Pusan National University Ki-Joune Li.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
Concurrency Control Techniques
Outline Introduction Background Distributed DBMS Architecture
Concurrency Control Chapter 17
Outline Introduction Background Distributed DBMS Architecture
Concurrency Control and Reliable Commit Protocol in Distributed Database Systems Jian Jia Chen 2002/05/09 Real-time and Embedded System Lab., CSIE, National.
Distributed Database Management Systems
Concurrency Control Chapter 17
Chapter 7: Distributed Transactions
Database Management System
Outline Introduction Background Distributed DBMS Architecture
Presentation transcript:

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database Design Distributed Query Processing Distributed Transaction Management  Transaction Concepts and Models  Distributed Concurrency Control  Distributed Reliability Building Distributed Database Systems (RAID) Mobile Database Systems Privacy, Trust, and Authentication Peer to Peer Systems

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Concurrency Control Algorithms Pessimistic  Two-Phase Locking-based (2PL)  Centralized (primary site) 2PL  Primary copy 2PL  Distributed 2PL  Timestamp Ordering (TO)  Basic TO  Multiversion TO  Conservative TO  Hybrid Optimistic  Locking-based  Timestamp ordering-based

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Locking-Based Algorithms Transactions indicate their intentions by requesting locks from the scheduler (called lock manager). Locks are either read lock ( rl ) [also called shared lock] or write lock ( wl ) [also called exclusive lock] Read locks and write locks conflict (because Read and Write operations are incompatible rl wl rl yesno wl nono Locking works nicely to allow concurrent processing of transactions.

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Two-Phase Locking (2PL)  A Transaction locks an object before using it.  When an object is locked by another transaction, the requesting transaction must wait.  When a transaction releases a lock, it may not request another lock. Obtain lock Release lock Lock point Phase 1Phase 2 BEGINEND No. of locks

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Strict 2PL Hold locks until the end. Obtain lock Release lock BEGINEND Transaction duration period of data item use

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Testing for Serializability Consider transactions T 1, T 2, …, T k Create a directed graph (called a conflict graph), whose nodes are transactions. Consider a history of transactions. If T 1 unlocks an item and T 2 locks it afterwards, draw an edge from T 1 to T 2 implying T 1 must precede T 2 in any serial history T 1 →T 2 Repeat this for all unlock and lock actions for different transactions. If graph has a cycle, the history is not serializable. If graph is a cyclic, a topological sorting will give the serial history.

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Example T 1 :Lock X T 1 : Unlock X T 2 :Lock X T 2 : Lock Y T 2 : Unlock X T 2 :Unlock Y T 3 :Lock Y T 3 :Unlock Y T 1 →T 2 T 2 →T 3 T2T2 T1T1 T3T3

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Theorem Two phase locking is a sufficient condition to ensure serializablility. Proof: By contradiction. If history is not serializable, a cycle must exist in the conflict graph. This means the existence of a path such as T 1 →T 2 →T 3 … T k → T 1. This implies T 1 unlocked before T 2 and after T k. T 1 requested a lock again. This violates the condition of two phase locking.

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez 2PL from Jeff Ullman's book

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Centralized 2PL There is only one 2PL scheduler in the distributed system. Lock requests are issued to the central scheduler. Data Processors at participating sites Coordinating TMCentral Site LM Lock Request Lock Granted Operation End of Operation Release Locks

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Distributed 2PL 2PL schedulers are placed at each site. Each scheduler handles lock requests for data at that site. A transaction may read any of the replicated copies of item x, by obtaining a read lock on one of the copies of x. Writing into x requires obtaining write locks for all copies of x.

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Distributed 2PL Execution Coordinating TMParticipating LMsParticipating DPs Lock Request Operation End of Operation Release Locks

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Timestamp Ordering Transaction ( T i ) is assigned a globally unique timestamp ts ( T i ). Transaction manager attaches the timestamp to all operations issued by the transaction. Each data item is assigned a write timestamp ( wts ) and a read timestamp ( rts ):  rts ( x ) = largest timestamp of any read on x  wts ( x ) = largest timestamp of any read on x Conflicting operations are resolved by timestamp order. Basic T/O: for R i ( x )for W i ( x ) if ts ( T i ) < wts ( x ) if ts ( T i ) < rts ( x ) and ts ( T i ) < wts ( x ) then reject R i ( x ) then reject W i ( x ) else accept R i ( x ) else accept W i ( x ) rts ( x )  ts ( T i ) wts ( x )  ts ( T i )

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Basic timestamp ordering tries to execute an operation as soon as it receives it  progressive  too many restarts since there is no delaying Conservative timestamping delays each operation until there is an assurance that it will not be restarted Assurance?  No other operation with a smaller timestamp can arrive at the scheduler  Note that the delay may result in the formation of deadlocks Conservative Timestamp Ordering

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Multiversion Timestamp Ordering Do not modify the values in the database, create new values. A R i ( x ) is translated into a read on one version of x.  Find a version of x (say x v ) such that ts ( x v ) is the largest timestamp less than ts ( T i ). A W i ( x ) is translated into W i ( x w ) and accepted if the scheduler has not yet processed any R j ( x r ) such that ts ( T i ) < ts ( x r ) < ts ( T j )

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Optimistic Concurrency Control Algorithms Pessimistic execution Optimistic execution ValidateReadComputeWrite ValidateReadComputeWrite