Documente Academic
Documente Profesional
Documente Cultură
Introduction to
Database Systems
Mohammad Imran
Lecturer
Department of Information Technology
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015
Balochistan University of Information Technology, Engineering & Management Sciences
Lecture 10
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 2
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 4
Balochistan University of Information Technology, Engineering & Management Sciences
Recovery Manager
• DBMS subsystem responsible for ensuring atomicity and
durability for transactions in the event of failure
o Atomicity - all of a transaction is performed or none
• Recovery manager ensures that all the effects of committed
transactions reach the database, and that the effects of any
uncommitted transactions are undone
o Durability - effects of a committed transaction are
permanent
• Effects must survive loss of main memory
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 5
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 6
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 7
Balochistan University of Information Technology, Engineering & Management Sciences
System Failure
• If system failure occurs
o Database buffers are lost
o Disk copy of the database survives, but it may be incorrect, due to partial
transactions
• A transaction can commit once its writes are made to the database buffers
• Updates made to buffer are not automatically written to disk, even for
committed transactions
• May be a delay between commit and actual disk writing
• If system fails during this delay, we must ensure that these updates reach
the disk copy of the database
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 8
Balochistan University of Information Technology, Engineering & Management Sciences
Storage Structure
• To understand recovery management of database, we
first need to understand the storage structure of the
system
• You already studied storage structure can be divided into
two categories:
o Volatile storage
o Non-volatile storage
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 9
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 10
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 11
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 14
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 15
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 16
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 17
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 18
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 19
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 20
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 21
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 22
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 24
Balochistan University of Information Technology, Engineering & Management Sciences
Checkpoints
• Problems in recovery procedure:
1. searching the entire log is time-consuming
2. we might unnecessarily redo transactions which have already
output their updates to the database
• Streamline recovery procedure by periodically performing
checkpointing
1. Output all log records currently residing in main memory onto
stable storage.
2. Output all modified buffer blocks to the disk
3. Write a log record < checkpoint> onto stable storage
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 25
Balochistan University of Information Technology, Engineering & Management Sciences
Checkpoints (Cont.)
• During recovery we need to consider only the most recent transaction Ti that
started before the checkpoint, and transactions that started after Ti
1. Scan backwards from end of log to find the most recent
<checkpoint> record
2. Continue scanning backwards till a record <Ti start> is found
3. Need only consider the part of log following above start record
Earlier part of log can be ignored during recovery
4. For all transactions (starting from Ti or later) with no <Ti commit>,
execute undo(Ti). (Done only in case of immediate modification)
5. Scanning forward in the log, for all transactions starting from Ti or
later with a <Ti commit>, execute redo(Ti).
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 26
Balochistan University of Information Technology, Engineering & Management Sciences
Example of Checkpoints
Tc Tf
T1
T2
T3
T4
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 27
Balochistan University of Information Technology, Engineering & Management Sciences
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015 28
Balochistan University of Information Technology, Engineering & Management Sciences
Thank you
Introduction to Database Systems Spring 2015 Mohammad Imran July 27, 2015