Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Virtual University of Pakistan Database Management System Lecture - 43.

Similar presentations


Presentation on theme: "© Virtual University of Pakistan Database Management System Lecture - 43."— Presentation transcript:

1 © Virtual University of Pakistan Database Management System Lecture - 43

2 © Virtual University of Pakistan Write Sequence  For a write operation entry is made in log file in RAM  On commit, first,  Database buffer is updated  Log file is moved to disk log file  Then write is performed from DB buffer is moved to disk

3 © Virtual University of Pakistan Recovery Sequence  If system crashes  On restart, recovery manager examines the log file  Transactions with begin and commit to be redone  No action for begin and aborted

4 © Virtual University of Pakistan Checkpoint Record  Repetition, no harm  How far in the log file should be redone  Checkpoint record is inserted in log file at certain intervals

5 © Virtual University of Pakistan At Checkpoint  Modified DB buffers to disk  All log records from buff to disk  Writing a checkpoint record to log; log record mentions all active transactions at the time

6 © Virtual University of Pakistan Recovery Routine  Check last check point  Any transaction committed before checkpoint, no action  On or started after and commit: redone  On and abort, or on and no end: no action

7 © Virtual University of Pakistan Summary of Deferred Updates  Writes are deferred until commit for transaction is found  For recovery purpose, log file is maintained  Log file helps to redo the actions that may be lost due to system crash  Log file also contains checkpoint recods

8 © Virtual University of Pakistan Immediate Updates  Incremental log with immediate updates  DB buffers are updated immediately, and files updated when convenient

9 © Virtual University of Pakistan Write Sequence  Start Tr record in log,  On write operation, write a log record  Move log record to file  Update the DB when convenient  On commit write in log file

10 © Virtual University of Pakistan Recovery Sequence  Trs with commit to redo, by copying new values  Trs, with abort or no end undo, by copying the old value  Repetition doesn’t matter  Checkpoint record can be used

11 © Virtual University of Pakistan Summary of DB Recovery  An improper shut down may damage database consistency  Has to be detected and database to be brought in an consistent state

12 © Virtual University of Pakistan  Log file contains records of all updates  Updates may be deferred or immediate, record entries vary  Transactions are redone or undone depending on situation  Checkpoints help in efficient database recovery

13 © Virtual University of Pakistan Concurrency Control

14 © Virtual University of Pakistan Concurrent Access  Sharing, one of the basic objective  Multiple users accessing simultaneously is preferred  Operations of more than one transactions can be performed simultaneously; interleaved transactions

15 © Virtual University of Pakistan Concurrent Access  Two factors allow concurrent access  Processors being very fast  I/O controller can handle I/O  Problems due to interleaving

16 © Virtual University of Pakistan Concurrency Control?  Three problems due to interleaved transaction  Lost Update  Uncommitted Update  Inconsistent Analysis

17 © Virtual University of Pakistan Lost Update Problem TIMETATBBAL t1t1 Read (BAL)1000 t2t2 …….Read (BAL)1000 t3t3 BAL = BAL - 50……..1000 t4t4 Write (BAL)950 t5t5 …….BAL = BAL + 10950 t6t6 ……..Write (BAL)1010

18 © Virtual University of Pakistan Database Management System Lecture - 43


Download ppt "© Virtual University of Pakistan Database Management System Lecture - 43."

Similar presentations


Ads by Google