







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A part of the lecture notes for cis 560: database system concepts at kansas state university. It covers the topic of transactions, their concept, state, and the acid properties. The document also discusses the importance of atomicity, consistency, isolation, and durability in database systems. It includes examples and explanations of transaction state and the implementation of atomicity and durability.
Typology: Slides
1 / 13
This page cannot be seen from the preview
Don't miss anything!








Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
Wednesday, 15 November 2006
William H. Hsu Department of Computing and Information Sciences, KSU
KSOL course page: http://snipurl.com/va Course web site: http://www.kddresearch.org/Courses/Fall-2006/CIS Instructor home page: http://www.cis.ksu.edu/~bhsu
Reading for Next Class: First half of Chapter 15, Silberschatz et al. , 5th^ edition
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z Transaction Concept z Transaction State z Concurrent Executions z Serializability z Recoverability z Implementation of Isolation z Transaction Definition in SQL z Testing for Serializability.
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z A transaction is a unit of program execution that accesses and possibly updates various data items. z A transaction must see a consistent database. z During transaction execution the database may be temporarily inconsistent. z When the transaction completes successfully (is committed), the database must be consistent. z After a transaction commits, the changes it has made to the database persist, even if there are system failures. z Multiple transactions can execute in parallel. z Two main issues to deal with: Failures of various kinds, such as hardware failures and system crashes Concurrent execution of multiple transactions
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z Atomicity. Either all operations of the transaction are properly reflected in the database or none are. z Consistency. Execution of a transaction in isolation preserves the consistency of the database. z Isolation. Although multiple transactions may execute concurrently, each transaction must be unaware of other concurrently executing transactions. Intermediate transaction results must be hidden from other concurrently executed transactions. That is, for every pair of transactions T (^) i and T (^) j, it appears to T (^) i that either T (^) j, finished execution before T (^) i started, or T (^) j started execution after T (^) i finished. z Durability. After a transaction completes successfully, the changes it has made to the database persist, even if there are system failures.
A transaction is a unit of program execution that accesses and possibly updates various data items.To preserve the integrity of data the database system must ensure:
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z Active – the initial state; the transaction stays in this state while it is executing z Partially committed – after the final statement has been executed. z Failed -- after the discovery that normal execution can no longer proceed. z Aborted – after the transaction has been rolled back and the database restored to its state prior to the start of the transaction. Two options after it has been aborted: restart the transaction; can be done only if no internal logical error kill the transaction z Committed – after successful completion.
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z The recovery-management component of a database system implements the support for atomicity and durability. z The shadow-database scheme: assume that only one transaction is active at a time. a pointer called db_pointer always points to the current consistent copy of the database. all updates are made on a shadow copy of the database, and db_pointer is made to point to the updated shadow copy only after the transaction reaches partial commit and all updated pages have been flushed to disk. in case transaction fails, old consistent copy pointed to by db_pointer can be used, and the shadow copy can be deleted.
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
extremely inefficient for large databases (why?) Does not handle concurrent transactions
The shadow-database scheme :
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z Let T 1 and T 2 be the transactions defined previously_._ The following schedule is not a serial schedule, but it is equivalent to Schedule 1.
In Schedules 1, 2 and 3, the sum A + B is preserved.
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z The following concurrent schedule does not preserve the value of ( A + B).
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
conflict equivalent. z We say that a schedule S is conflict serializable if it is conflict equivalent to a serial schedule
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
Therefore Schedule 3 is conflict serializable.
Schedule 3 Schedule 6
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z Example of a schedule that is not conflict serializable:
z We are unable to swap instructions in the above schedule to obtain either the serial schedule < T 3 , T 4 >, or the serial schedule < T 4 , T 3 >.
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
three conditions are met:
Computing & Information Sciences CIS 560: Database System Concepts Wednesday, 15 Nov 2006 Kansas State University
z Consider some schedule of a set of transactions T 1 , T 2 , ..., Tn z Precedence graph — a direct graph where the vertices are the transactions (names). z We draw an arc from Ti to Tj if the two transaction conflict, and Ti accessed the data item on which the conflict arose earlier. z We may label the arc by the item that was accessed. z Example 1 x
y