1
28kviews
Describe the shadow paging recovery technique
1 Answer
2
620views

• Shadow paging is a technique for providing atomicity and durability in database systems.

• Shadow paging is a copy-on-write technique for avoiding in-place updates of pages. Instead, when a page is to be modified, a shadow page is allocated.

• Since the shadow page has no references (from other pages on disk), it can be modified liberally, without concern for consistency constraints, etc. When the page is ready to become durable, all pages that referred to the original are updated to refer to the new replacement page instead. Because the page is "activated" only when it is ready, it is atomic.

• This increases performance significantly by avoiding many writes on hotspots high up in the referential hierarchy (e.g.: a file system superblock) at the cost of high commit latency.

Shadow paging considers:

  1. The database is partitioned into fixed-length blocks referred to as PAGES.

  2. Page table has n entries – one for each database page.

  3. Each contain pointer to a page on disk (1 to 1st page on database and so on…).

The idea is to maintain 2 pages tables during the life of transaction.

  1. The current page table

  2. The shadow page table

When transaction starts, both page tables are identical

  1. The shadow page table is never changed over the duration of the transaction.

  2. The current page table may be changed when a transaction performs a write operation.

  3. All input and output operations use the current page table to locate database pages on disk.

enter image description here

Advantages:

• No Overhead for writing log records.

• No Undo / No Redo algorithm.

• Recovery is faster.

Disadvantages:

• Data gets fragmented or scattered.

• After every transaction completion database pages containing old version of modified data need to be garbage collected.

• Hard to extend algorithm to allow transaction to run concurrently.

Please log in to add an answer.