Granularity of Locks and Degrees of Consistency in a Shared Data Base Part II: The Paper Strikes Back By Kyle Imrie.

Slides:



Advertisements
Similar presentations
1 Term 2, 2004, Lecture 6, TransactionsMarian Ursu, Department of Computing, Goldsmiths College Transactions 3.
Advertisements

CM20145 Concurrency Control
Introduction to Database Systems1 Concurrency Control CC.Lecture 1.
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.
Transactions (Chapter ). What is it? Transaction - a logical unit of database processing Motivation - want consistent change of state in data Transactions.
1 CSIS 7102 Spring 2004 Lecture 8: Recovery (overview) Dr. King-Ip Lin.
Quick Review of Apr 29 material
Database Administration Chapter Six DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
Transaction Management and Concurrency Control
Granularity of Locks and Degrees of Consistency in a Shared Data Base John LaFontaine Haixuan Sun.
Quick Review of May 1 material Concurrent Execution and Serializability –inconsistent concurrent schedules –transaction conflicts serializable == conflict.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transaction Management
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
Database Administration Part 1 Chapter Six CSCI260 Database Applications.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transaction. A transaction is an event which occurs on the database. Generally a transaction reads a value from the database or writes a value to the.
Transactions and Recovery
Transactions Sylvia Huang CS 157B. Transaction A transaction is a unit of program execution that accesses and possibly updates various data items. A transaction.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
TRANSACTIONS. Objectives Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation Transaction.
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220m.htm
Concurrency and Transaction Processing. Concurrency models 1. Pessimistic –avoids conflicts by acquiring locks on data that is being read, so no other.
Lecture 12 Recoverability and failure. 2 Optimistic Techniques Based on assumption that conflict is rare and more efficient to let transactions proceed.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
Transactions CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
1 Transactions Chapter Transactions A transaction is: a logical unit of work a sequence of steps to accomplish a single task Can have multiple.
11/7/2012ISC329 Isabelle Bichindaritz1 Transaction Management & Concurrency Control.
Transactions. What is it? Transaction - a logical unit of database processing Motivation - want consistent change of state in data Transactions developed.
© 2002 by Prentice Hall 1 Database Administration David M. Kroenke Database Concepts 1e Chapter 6 6.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
Chapter 15: Transactions Loc Hoang CS 157B. Definition n A transaction is a discrete unit of work that must be completely processed or not processed at.
Database Systems Recovery & Concurrency Lecture # 20 1 st April, 2011.
7c.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Module 7c: Atomicity Atomic Transactions Log-based Recovery Checkpoints Concurrent.
15.1 Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various data items. E.g. transaction to transfer.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Section 06 (a)RDBMS (a) Supplement RDBMS Issues 2 HSQ - DATABASES & SQL And Franchise Colleges By MANSHA NAWAZ.
1 CSE 480: Database Systems Lecture 24: Concurrency Control.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
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.
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.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
SYSTEMS IMPLEMENTATION TECHNIQUES TRANSACTION PROCESSING DATABASE RECOVERY DATABASE SECURITY CONCURRENCY CONTROL.
Database Recovery Techniques
Database Recovery Techniques
Transaction Management
Transaction Management and Concurrency Control
Database Management System
Isolation Levels Understanding Transaction Temper Tantrums
Advanced Operating Systems - Fall 2009 Lecture 8 – Wednesday February 4, 2009 Dan C. Marinescu Office: HEC 439 B. Office hours: M,
Transactions.
Transaction Management
Transaction Properties
Concurrency.
Transactions, Locking and Query Optimisation
Transactions Sylvia Huang CS 157B.
Chapter 10 Transaction Management and Concurrency Control
Outline Introduction Background Distributed DBMS Architecture
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Transaction management
Transactions and Concurrency
Database Recovery 1 Purpose of Database Recovery
Database Administration
Chapter 14: Transactions
Isolation Levels Understanding Transaction Temper Tantrums
UNIT -IV Transaction.
Presentation transcript:

Granularity of Locks and Degrees of Consistency in a Shared Data Base Part II: The Paper Strikes Back By Kyle Imrie

Setting the Stage for the Paper

What happened in the first part of the paper? RECAP: Paper was written in 1976, by researchers at IBM Research Laboratory The first half of the paper described the problem of choosing at what level of the database should locks be introduced The issue of consistency vs performance overhead is also detailed New locking protocols are introduced

What are the main subjects of this paper? Defining important terms; transaction, database, consistency Laying out the general definition of “degrees of consistency” Defining consistency with respect to inputs/outputs Defining consistency with respect to locks Defining consistency with respect to dependencies

Establishing Definitions

What is a Database? The paper describes a Database as a “a set of entities structured to form assertions”. These assertions can be any kind of logical or algebraic statement about the contents of the database. For example...

Employee Table Name Department Amy Finance Barry Sales Charlene Department Table Name Size Finance 2 Sales 1 Assertion: The Size # for a department is equivalent to the count of employees with that department in Employee table

What is Consistency? A database can be said to be consistent when ALL of its assertions are satisfied. We wouldn’t want our data to be inconsistent! A database can become temporarily inconsistent: say we were adding a new member to the finance team in our previous example. Until all actions associated with adding a new employee is complete, our Size value may be incorrect.

What is a Transaction? Transactions are sets of atomic actions which bring our database from one consistent to another. Transactions are described as “units of consistency” in the paper; if a transaction fails midway, its actions can be undone to return the database to a consistent state. The database system software in use can enforce the consistency of any attempted transaction, such that the database is never left in an inconsistent state.

Formalizing the Definition of Consistency

General Degrees of Consistency Each degree of consistency builds on top of the previous, at the cost of more system overhead. Degree 0: Protects others from from your updates Degree 1: Protects from losing your own updates Degree 2: Protects from reading incorrect data items Degree 3: Protects from reading incorrect relationships among data items The meanings of these degrees will be explored in the next few sections.

Consistency with Inputs/Outputs

More definitions! Committing: Once a transaction has finished altering a record of data and has “abdicated” the right to make any undo operations, that write action is said to be fully committed. The value is then “okay” for other transactions to read Dirty Data: If not all changes to a record have been committed, the data is said to be dirtied, as it could still be read by other transactions Important note: These are separate notions from locking

Consistency with Inputs/Outputs Degree 0: Your transaction will not overwrite the dirty data of other transactions Degree 1: Your transaction will not commit any writes until the end of the transaction Degree 2: Your transaction will not read any dirty data from other transactions Degree 3: Other transactions will not dirty any data read by your transaction until your transaction is finished

The Implication of these Definitions Recoverability of transactions: A transaction is said to be recoverable if it can be undone without affecting other transactions For example, Degree 0 transactions are unrecoverable because they commit their writes before the end of transaction. Thus, if a single transaction writes to the same record twice, another transaction could read the record between changes, creating an inconsistency Usually, database system software requires that all transactions be at least Degree 1 consistent

Issue with Degree 2 Transaction Step Action 1 Read A 2 Write A to B 3 4 Write A**2 to C During Step 2, a complete other (fully-committed) transaction can take place, altering the value of A. This would lead to an inconsistency. Degree 3 avoids this.

Consistency with Locks

Recap on Types of Locks Share-mode lock: Allows for multiple readers to read from the record Exclusive-mode lock: Whoever sets the lock has exclusive access to the record Short duration lock: Lock only lasts for the duration of a single action Long duration lock: Lock lasts for the entirety of the transaction

Consistency with Locks Degree 0: Your transaction sets a short exclusive lock on any data it dirties Degree 1: Your transaction sets a long exclusive lock on any data it dirties Degree 2: Your transaction sets a short share lock on any data it reads Degree 3: Your transaction sets a long share lock on any data it reads

Extending these Definitions Well-formedness: A transaction is well-formed if it always sets an appropriate lock when reading or writing Two-phase: A transaction is two-phased if it never locks a record after unlocking some other record, i.e a shrinking and growing phase for locks The previous definitions for consistency were too restrictive; it is not necessary for a lock to be held until the end of transaction for a transaction to be consistent Once a record is unlocked, it can be considered “committed”

Rewriting the Lock Protocols Degree 0: Your transaction is well-formed with respect to writes Degree 1: Your transaction is also two-phased with respect to writes Degree 2: Your transaction is well-formed with respect to writes and reads Degree 3: Your transaction is also two-phased with respect to writes and reads ALL transactions are required to be at least Degree 0 consistent with respect to locks so that transactions do not overwrite the uncommitted updates of other transactions

Dependencies among Transactions

What is a Schedule of Transactions? Schedule: a sequence-preserving merging of the actions of a set of transactions A schedule can be run in serial or run concurrently; obviously, in the serial case, no concurrency issues exist

Different Degrees of Dependency Notation: Let T and T’ be two transactions operating on the same record, with A and A’ be actions associated with each, and with T’ taking place after T in the schedule T < T’: If A is a write action, and A’ is a write action T << T’: If A is a write action and A’ is a write action, or A is a write action and A’ is a read action T <<< T’: If A is a write action and A’ is a write action, or A is a write action and A’ is a read action, or A is a read action and A’ is a write action

Who Cares About These <’s? Understanding the transaction dependencies can affect how a system recovery operation would take place, in case of database failure or some incomplete transaction takes place For more detail on this procedure, check out On the Notions of Consistency and Predicate Locks, also by IBM Research Laboratory

Questions?