0% found this document useful (0 votes)
16 views2 pages

Shadow Paging for Database Recovery

The document explains shadow paging, a recovery technique that maintains data integrity during database transactions by using a dual-page table system. It describes how the shadow page table preserves the original state of the database while the current page table reflects updates, allowing for efficient crash recovery and transaction management. Upon successful transactions, the shadow table is replaced, while aborted transactions leave the original state unchanged.

Uploaded by

ggottamsindhu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Shadow Paging for Database Recovery

The document explains shadow paging, a recovery technique that maintains data integrity during database transactions by using a dual-page table system. It describes how the shadow page table preserves the original state of the database while the current page table reflects updates, allowing for efficient crash recovery and transaction management. Upon successful transactions, the shadow table is replaced, while aborted transactions leave the original state unchanged.

Uploaded by

ggottamsindhu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

This technique ensures that a database can recover seamlessly from failures without

losing data integrity. During a transaction, updates are made to a new version of the
database pages tracked by the current page table, while the shadow page table preserves
the pre-transaction state. This dual-table approach allows for efficient crash recovery and
simplifies the commit and rollback processes.
Page Table : A page table is a data structure that maps logical pages (a logical division of
data) to physical pages (actual storage on disk).
 Each entry in the page table corresponds to a physical page location on the disk.
 The database uses the page table to retrieve or modify data.
How Shadow Paging Works ?
Shadow paging is a recovery technique that views the database as a collection of fixed-
sized logical storage units, known as pages, which are mapped to physical storage blocks
using a structure called the page table. The page table enables the system to efficiently
locate and manage database pages.
Here’s how shadow paging works in detail:
Start of Transaction:
 The shadow page table is created by copying the current page table.
 The shadow page table represents the original, unmodified state of the database.
 This table is saved to disk and remains unchanged throughout the transaction.
Logical Page Shadow Page Table (Disk) Current Page Table

P1 Address_1 Address_1

P2 Address_2 Address_2

P3 Address_3 Address_3

Transaction Execution:
 Updates are made to the database by creating new pages.
 The current page table reflects these changes, while the shadow page table remains
unchanged.
Page Modification:
If a logical page (e.g. P2) needs to be updated:
 A new version of the page (P2’) is created in memory and written to a new physical
storage block.
 The current page table entry for P2 is updated to point to P2’.
 The shadow page table still points to the original page P2, ensuring it is unaffected by
the changes.
Logical Page Shadow Page Table (Disk) Current Page Table

P1 Address_1 Address_1

P2 Address_2 Address_4 (P2′)

P3 Address_3 Address_3

Commit:
 If the transaction is successful, the shadow page table is replaced by the current page
table.
 This replacement makes the changes permanent.
Logical Page Shadow Page Table (Disk) Current Page Table

P1 Address_1 Address_1

P2 Address_4 (P2′) Address_4 (P2′)

P3 Address_3 Address_3

Abort:
 If the transaction is aborted, the current page table is discarded, leaving the shadow
page table intact.
 Since the shadow page table still points to the original pages, no changes are reflected
in the database.

You might also like