0
9.3kviews
Explain shadow page recovery.

**Mumbai University > Computer Engineering > Sem 4 > Database Management System

Marks: 5 M

Year: ** Dec 2014

1 Answer
0
222views
  • This recovery technique is an alternative to log-based recovery. The aim of this recovery is to maintain two page tables during the lifetime of a transaction namely the current page table and the shadow page table (figure1).

enter image description here

  • Shadow paging considers the database to be made up of a number of fixed size disk pages for recovery purposes.
  • A directory with N entries has the ith entry pointing to the ith database page on disk.
  • When a transaction begins, the current directory with entries pointing to the most recent or current database pages on disk is copied into a shadow directory.
  • The shadow directory is saved on non-volatile disk while the current directory is used by the transaction.
  • During transaction execution, the shadow directory is never modified. When a write operation is performed, a new copy of the modified database page is created without over-writing the old copy of that page.
  • The new page is written elsewhere on some previously unused disk block. The current directory entry gets modified and points to the new disk block while the shadow directory is not modified and keeps pointing at the old unmodified disk block.
  • For pages updated by the transaction, two versions are kept. The old version is referenced by the shadow directory and the new version by the current directory.
  • To recover from a failure during transaction execution, the modified database pages are freed and the current directory discarded.
  • The state of the database before transaction execution is available through the shadow directory and that state is recovered by reinstating the shadow directory.
  • The database returns to its state prior to the transaction that was executing when the crash occurred and modified pages get discarded.
  • Committing a transaction corresponds to discarding the previous shadow directory.
  • Advantages:
    • No over-head of writing log records
    • Recovery is trivial
  • Disadvantages:
    • Commit overhead is high
    • Data gets defragmented
    • Hard to extend algorithm to allow transaction to run concurrently.
Please log in to add an answer.