Module-6 Dbms Cs208 Note
Module-6 Dbms Cs208 Note
Module 6
The basic database access operations that a transaction can include are as
follows:
o write_item(X): Writes the value of program variable X into the database item
named X.
Concurrency control
Why we need concurrency control?
KTU STUDENTS
The Lost Update Problem
This problem occurs when two transactions that access the same database items
have their operations interleaved in a way that makes the update operation of one
of the transactions lost .
This problem occurs when one transaction updates a database item and then the
transaction fails for some reason. The updated item is accessed by another
transaction before it is changed back to its original value.
When a transaction T reads an item twice and the item is changed by another
transaction T' between the two reads; hence, T receives different values for its two
reads of the same item.
Recovery
Whenever a failure occurs, the system must keep sufficient information to recover
from the failure.
The recovery manager keeps track of the following operations:
1. BEGIN_TRANSACTION
2. READ or WRITE
3. END_TRANSACTION
4. COMMIT_TRANSACTION: This signals a successful end of the
transaction so that any changes (updates) executed by the transaction can be
safely committed to the database and will not be undone.
5. ROLLBACK (or ABORT): This signals that the transaction has ended
unsuccessfully, so that any changes or effects that the transaction may have
applied to the database must be undone.
A system log is a disk file that keeps track of all transaction operations that affect
KTU STUDENTS
the values of database items.
Acid properties
KTU STUDENTS
Two operations in a schedule are said to conflict if they satisfy all three of the
following conditions:
A strict schedule are composed of transactions that can neither read nor write an
item X until the last transaction that wrote X has committed (or aborted).
Serializability of Schedules
In a serial schedule, the operations of each transaction are executed consecutively,
without any interleaved operations from other transactions.
Conflict serializability
KTU STUDENTS
In this example, the transaction acquires all of the locks it needs until it
reaches its locked point. (In this example, the transaction requires two
locks.) When the locked point is reached, the data are modified to
conform to the transaction’s requirements. Finally, the transaction is
completed as it releases all of the locks it acquired in the first phase.
Failure classification
Storage structure
KTU STUDENTS
Stable storage
KTU STUDENTS
Log based recovery
KTU STUDENTS
Check pointing
KTU STUDENTS
KTU STUDENTS
10