Concurrency Control In Dynamic Database Systems Laurel Jones.

Slides:



Advertisements
Similar presentations
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Advertisements

Lecture plan Transaction processing Concurrency control
Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
Database Systems (資料庫系統)
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.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Concurrency Control II
Concurrency Control Amol Deshpande CMSC424. Approach, Assumptions etc.. Approach  Guarantee conflict-serializability by allowing certain types of concurrency.
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.
1 Supplemental Notes: Practical Aspects of Transactions THIS MATERIAL IS OPTIONAL.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Transaction Management and Concurrency Control
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transaction Processing: Concurrency and Serializability 10/4/05.
Transaction Management
ICS (072)Concurrency Control1 Transaction Processing and Concurrency Control Dr. Muhammad Shafique Chapter March 2008.
ACS-4902 R. McFadyen 1 Chapter 18 Database Concurrency Control Locking 18.1 Shared/Exclusive (aka Read/Write) Locks Lock Operations Read_lock(X) Write_lock(X)
Transactions Amol Deshpande CMSC424. Today Project stuff… Summer Internships 
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
System Catalogue v Stores data that describes each database v meta-data: – conceptual, logical, physical schema – mapping between schemata – info for query.
© 1997 UW CSE 11/13/97N-1 Concurrency Control Chapter 18.1, 18.2, 18.5, 18.7.
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari.
AN OPTIMISTIC CONCURRENCY CONTROL ALGORITHM FOR MOBILE AD-HOC NETWORK DATABASES Brendan Walker.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
Chapterb19 Transaction Management Transaction: An action, or series of actions, carried out by a single user or application program, which reads or updates.
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220m.htm
ICS (072)Concurrency Control Techniques1 Concurrency Control Techniques Chapter 18 Dr. Muhammad Shafique.
Ch 10: Transaction Management and Concurrent Control.
Transactions CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Concurrency Control Techniques Chapter 18
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
1 Transactions Chapter Transactions A transaction is: a logical unit of work a sequence of steps to accomplish a single task Can have multiple.
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
11/7/2012ISC329 Isabelle Bichindaritz1 Transaction Management & Concurrency Control.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two schedules are conflict equivalent if:  Involve the same actions of the same.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
A Survey on Optimistic Concurrency Control CAI Yibo ZHENG Xin
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Transactions and Concurrency Control Fall 2007 Himanshu Bajpai
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Concurrency Control Introduction Lock-Based Protocols
1 Concurrency control lock-base protocols timestamp-based protocols validation-based protocols Ioan Despi.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
1 Database Systems ( 資料庫系統 ) December 27, 2004 Chapter 17 By Hao-hua Chu ( 朱浩華 )
6.830 Lecture 14 Two-phase Locking Recap Optimistic Concurrency Control 10/28/2015.
1 Lecture 4: Transaction Serialization and Concurrency Control Advanced Databases CG096 Nick Rossiter [Emma-Jane Phillips-Tait]
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Lecture 9- Concurrency Control (continued) Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
3 Database Systems: Design, Implementation, and Management CHAPTER 9 Transaction Management and Concurrency Control.
Concurrency Control Techniques
Database Concurrency Control
4. Concurrency control techniques
Concurrency Control II (OCC, MVCC)
11/29/2018.
Chapter 10 Transaction Management and Concurrency Control
Ch 22: Databases Concurrency Control
Basic Two Phase Locking Protocol
6.830 Lecture 14 Two-phase Locking Recap Optimistic Concurrency Control 10/28/2015.
Concurrency Control Chapter 17
Temple University – CIS Dept. CIS661 – Principles of Data Management
Submitted to Dr. Badie Sartawi Submitted by Nizar Handal Course
Concurrency control (OCC and MVCC)
Database Systems (資料庫系統)
Presentation transcript:

Concurrency Control In Dynamic Database Systems Laurel Jones

Overview Quick Review of what we already know Some Concurrency Control Model for Static Databases Concurrency Control Models for Dynamic Databases Quick Review of what we already know Some Concurrency Control Model for Static Databases Concurrency Control Models for Dynamic Databases

Basic Definitions Concurrency Control: Software included within the DBMS that ensures data integrity in a multiuser database Software included within the DBMS that ensures data integrity in a multiuser database Transaction: An event that has a start and stop An event that has a start and stop Modifies the data Modifies the data

Basic Definitions con’t Locking: A lock is a variable associated with a data item that describes the status of the item with respect to possible operations that can be applied to it. A lock is a variable associated with a data item that describes the status of the item with respect to possible operations that can be applied to it. Binary Locks: mutually exclusive Binary Locks: mutually exclusive Multiple Mode Lock: Multiple Mode Lock: Shared/Exclusive or Read/Write Shared/Exclusive or Read/WriteGranularity: The size of a data item The size of a data item Fine (small) – field of some record Fine (small) – field of some record Course (large) – whole record or disk block Course (large) – whole record or disk block

Basic Definitions con’t Serial / Serializability / Serializable Serial – all the operations of a given transaction are executed consecutively Serial – all the operations of a given transaction are executed consecutively Serializability – which schedules are correct when transactions have interleaving of their operations Serializability – which schedules are correct when transactions have interleaving of their operations Serializable – refers to a schedule of transactions that is equivalent to some serial schedule of those same transactions Serializable – refers to a schedule of transactions that is equivalent to some serial schedule of those same transactions

Example Using binary locks or read/write locks does NOT guarantee serializability of schedules on its own. To guarantee serializability, we must follow an additional protocol concerning the positioning of locking and unlocking operations in every transaction.

Protocols to Maintain Serialization Two-Phase Locking (2PL) Timestamps Ordering Mulitversion Concurrency Multiversion based on Timestamp Multiversion 2PL with certify locks Optimistic Concurrency Control (OCC)

Two-Phase Locking Protocol (2PL) All locking operations (read or write) precede the first unlock operation in the transaction. Expanding Phase – new locks acquired but none released Expanding Phase – new locks acquired but none released Shrinking Phase – existing locks can be released but no new locks can be acquired. Shrinking Phase – existing locks can be released but no new locks can be acquired. Conservative - Strict - Rigorous Conservative – locks all items accessed before transaction begins execution. Conservative – locks all items accessed before transaction begins execution. All but Conservative have deadlock problems

Dealing with Deadlock Timestamps Timeouts – aborts transaction Wait-for Graphs

Optimistic Concurrency Control (OCC) No checking for serialization is done while the transaction is executing During transaction execution, all updates are applied to local copies of the data items that are kept for the transaction During a validation phase the transactions updates are check to see if they violate serializability

Three Phases of Optimistic CC Read Phase: A transaction can read values of committed data items from the database. However, updates are applied only to local copies (versions) of the data items kept in the transaction workspace Validation Phase: Checking is performed to ensure that serializability will not be violated if the transaction updates are applied to the database Write Phase: If the validation phase is successful, the transaction updates are applied to the database; otherwise the updates are discarded and the transaction is restarted

Optimistic CC con’t The idea behind OCC is to do all the checks at once If there is little interference between transactions, most will be validated successfully. Extra Requirements: Local Copy Local Copy Transaction Timestamps Transaction Timestamps Must keep track of write_set & read_set Must keep track of write_set & read_set

OCC Validation Phase During Validation the current transaction is checked against other transactions that are either in the validation phase or have been committed Given the current transaction T i and the transactions it is being checked against T j : T j completes its write phase before T i starts read phase. T j completes its write phase before T i starts read phase. T i completes its write phase after T j completes its write phase and T i ’s read_set has no items in common with T j ’s write_set. T i completes its write phase after T j completes its write phase and T i ’s read_set has no items in common with T j ’s write_set. T i read_set & write_set have no common items to T j ’s write_set, and T j completes its read phase before T i completes its read phase. T i read_set & write_set have no common items to T j ’s write_set, and T j completes its read phase before T i completes its read phase. These are checked in order and if at least one is true the transaction validates otherwise it is restarted.

What is a Dynamic Database? Real-Time DB Timing Constraints called “deadlines” Timing Constraints called “deadlines” Soft/Firm vs Hard Firm transactions must give in to hard transations due to their stringent timing requirement. Active DB Systems: A DB that is capable of initiation actions A DB that is capable of initiation actions Event – Condition – Action (triggering) Event – Condition – Action (triggering) Put these together and you get:

Real-Time Active Database Systems (RTABS) “The application domains for such databases are numerous – network management, manufacturing process control, intelligent highway systems and air traffic control.” Let’s take a look at a real world example: Traffic Collision Avoidance System Traffic Collision Avoidance System Traffic Collision Avoidance System Traffic Collision Avoidance System July 1, 2002 July 1, 2002 July 1, 2002 July 1, 2002 Timeliness and correctness of data is crucial Timeliness and correctness of data is crucial

The Importance of Concurrency Control in Dynamic Databases Many spin-offs of 2PL and OCC “In firm or hard real-time scenarios (i.e. where late transactions are worthless), optimistic concurrency control (OCC) outperforms locking over a large spectrum of system loading and resource contention conditions.” Datta & Son

Modifying OCC “It has been repeatedly shown that it is the number of restarts that determines the performance of real-time CC algorithms.” Datta & Son This has given rise to: OCC-FV (forward validation) OCC-FV (forward validation) OCC-BV (backward validation) OCC-BV (backward validation) OCC-DA (dynamic adjust) OCC-DA (dynamic adjust) OCC-BC (broadcast commit) OCC-BC (broadcast commit) OCC-APFO (Adaptive Priority Fan Out) OCC-APFO (Adaptive Priority Fan Out)

Decreasing Restarts in OCC Dynamically Adjusting the serialization Backward Validation (BV) – check against committed transactions Backward Validation (BV) – check against committed transactions Forward Validation (FV) – check against concurrent executing transactions Forward Validation (FV) – check against concurrent executing transactions

When Transactions Conflict Irreconcilably Which one do you restart? Deadlines Deadlines Transaction A might be targeted to restart but if it is restarted it has no hope of making its deadline. If transaction B will have time to complete restart it instead. Firm/soft transactions continually blocked by hard Firm/soft transactions continually blocked by hard Triggering Triggering If transaction A is targeted to restart but it has triggered several other transactions while B does not you might want to restart B instead. Deadlines of triggered transactions.

Adaptive Priority Fan Out OCC-APFO In this model the “Fan Out” refers to adjusting for the number of “triggered” transactions A Concurrency Priority Index (CPI) which takes into account the deadlines and fan- out of the transactions

Adaptive Priority Fan Out OCC-APFO con’t This model also takes into consideration that if a specific transaction is targeted for restart it still may not have enough time to meet it’s deadline. “OCC-APFO attempts to satisfy this goal (of reducing restarts) by restarting validating transactions only when it feels that the restarted transaction is very likely to commit eventually” Datta & Son

In Conclusion There are many different models used to ensure concurrency control in Dynamic Databases. OCC-APFO is one model that seemed to take in a variety variables when trying to reduce restarts: Dynamic serialization adjustments Dynamic serialization adjustments Deadlines Deadlines Triggered Transaction Triggered Transaction How many, and their deadlines How many, and their deadlines Will the restarted transaction be able to commit Will the restarted transaction be able to commit Back to reality (TCAS vs. Humans (ATC))