Transaction Isolation and Atomicity
14.7 Transaction Isolation and Atomicity
So far, we have studied schedules while assuming implicitly that there are no transaction failures. We now address the effect of transaction failures during concurrent execution.
3 Testing for view serializability has been proven to be NP-complete, which means that it is virtually certain that no efficient test for view serializability exists.
14.7 Transaction Isolation and Atomicity 647
T 6 T 7 read(A)
write(A) read(A) commit
read(B)
Figure 14.14 Schedule 9, a nonrecoverable schedule.
If a transaction T i fails, for whatever reason, we need to undo the effect of this transaction to ensure the atomicity property of the transaction. In a system that allows concurrent execution, the atomicity property requires that any trans- action T j that is dependent on T i (that is, T j has read data written by T i ) is also aborted. To achieve this, we need to place restrictions on the type of schedules permitted in the system.
In the following two subsections, we address the issue of what schedules are acceptable from the viewpoint of recovery from transaction failure. We describe in Chapter 15 how to ensure that only such acceptable schedules are generated.
14.7.1 Recoverable Schedules
Consider the partial schedule 9 in Figure 14.14, in which T 7 is a transaction that performs only one instruction: read(A). We call this a partial schedule because we have not included a commit or abort operation for T 6 . Notice that T 7 commits immediately after executing the read(A) instruction. Thus, T 7 commits while T 6 is still in the active state. Now suppose that T 6 fails before it commits. T 7 has read
the value of data item A written by T 6 . Therefore, we say that T 7 is dependent
on T 6 . Because of this, we must abort T 7 to ensure atomicity. However, T 7 has already committed and cannot be aborted. Thus, we have a situation where it is
impossible to recover correctly from the failure of T 6 .
Schedule 9 is an example of a nonrecoverable schedule. A recoverable schedule
is one where, for each pair of transactions T i and T j such that T j reads a data item previously written by T i , the commit operation of T i appears before the commit
operation of T j . For the example of schedule 9 to be recoverable, T 7 would have
to delay committing until after T 6 commits.
14.7.2 Cascadeless Schedules
Even if a schedule is recoverable, to recover correctly from the failure of a trans- action T i , we may have to roll back several transactions. Such situations occur if transactions have read data written by T i . As an illustration, consider the partial
schedule of Figure 14.15. Transaction T 8 writes a value of A that is read by transac- tion T 9 . Transaction T 9 writes a value of A that is read by transaction T 10 . Suppose that, at this point, T 8 fails. T 8 must be rolled back. Since T 9 is dependent on T 8 ,T 9 must be rolled back. Since T 10 is dependent on T 9 ,T 10 must be rolled back. This
648 Chapter 14 Transactions
T 8 T 9 T 10 read(A)
read(B) write(A)
read(A) write(A)
read(A) abort
Figure 14.15 Schedule 10.
phenomenon, in which a single transaction failure leads to a series of transaction rollbacks, is called cascading rollback .
Cascading rollback is undesirable, since it leads to the undoing of a significant amount of work. It is desirable to restrict the schedules to those where cascading rollbacks cannot occur. Such schedules are called cascadeless schedules. Formally,
a cascadeless schedule is one where, for each pair of transactions T i and T j such that T j reads a data item previously written by T i , the commit operation of T i appears before the read operation of T j . It is easy to verify that every cascadeless schedule is also recoverable.
Parts
» Indian Institute of Technology, Bombay
» Data Mining and Information Retrieval
» Structure of Relational Databases
» Database Schema When we talk about a database, we must differentiate between the database
» Basic Structure of SQL Queries
» Modification of the Database
» • Embedded SQL : Like dynamic SQL , embedded SQL provides a means by
» Advanced Aggregation Features**
» The Cartesian-Product Operation
» The Tuple Relational Calculus
» The Entity-Relationship Model
» • For an n-ary relationship set with an arrow on one of its edges, the primary
» Entity-Relationship Design Issues
» Representation of Generalization
» Alternative Notations for Modeling Data
» Other Aspects of Database Design
» Features of Good Relational Designs
» Atomic Domains and First Normal Form
» Decomposition Using Functional Dependencies
» BCNF Decomposition Algorithm
» Decomposition Using Multivalued Dependencies
» Application Programs and User Interfaces
» Overview of Physical Storage Media
» Magnetic Disk and Flash Storage
» Organization of Records in Files
» Comparison of Ordered Indexing and Hashing
» Implementation of Pipelining
» Evaluation Algorithms for Pipelining
» Transformation of Relational Expressions
» (A, r ), the number of distinct values that appear in the relation r for attribute
» Advanced Topics in Query Optimization**
» Transaction Atomicity and Durability
» Transaction Isolation and Atomicity
» Implementation of Isolation Levels
» Transactions as SQL Statements
» Weak Levels of Consistency in Practice
» Concurrency in Index Structures**
» Failure with Loss of Nonvolatile Storage
» Early Lock Release and Logical Undo Operations
» Centralized and Client – Server Architectures
» Parallelism on Multicore Processors
» Recovery and Concurrency Control
» Distributed Query Processing
» Heterogeneous Distributed Databases
» Partitioning and Retrieving Data
» Transactions and Replication
» Decision-Tree Construction Algorithm
» Relevance Ranking Using Terms
» Synonyms, Homonyms, and Ontologies
» Crawling and Indexing the Web
» Information Retrieval: Beyond Ranking of Pages
» Structured Types and Inheritance in SQL
» Array and Multiset Types in SQL
» Application Program Interfaces to XML
» Native Storage within a Relational Database
» Other Issues in Application Development
» Representation of Geographic Data
» Transaction-Processing Monitors
» Real-Time Transaction Systems
» PostgreSQL Implementation of MVCC
» Database Design and Querying Tools
» Database Administration Tools
» Business Intelligence Features
Show more