0
21kviews
Compare the shadow paging recovery scheme with the log-based recovery schemes in terms of ease of implementation and overhead cost.

Mumbai University > Information Technology > Sem 3 > Database Management System

Marks: 10 M

Year: May 2015

1 Answer
1
839views

1. Log Based Recovery

i. One of the most widely used structure for database modifications recording is the log.

ii. Log can be defined as a sequence of log records, recording all the update activities in the database.

iii. Log record contains various fields such as Transaction identifier, data item identifier, old value and new value.

iv. Whenever a transaction performs a write, it is essential that the log record for that write be created before the database is modified.

v. Once a log record exists, we can output the modification to the database if that is desirable.

vi. Also, we have the ability to undo a modification that has already been output to the database.

vii. We undo it by using the old-value field in log records.

2. Shadow Paging:

i. Shadow paging considers the database to be made up of a number of fixed size disk pages.

ii. A directory with n entries is constructed, where the ith entry points to the ith database page on disk.

iii. The directory is kept in main memory if it is not too large, and all read and write references, to the database pages on disk go through it.

iv. When a transaction begins executing, the current directory, whose entries point to the most recent or current database pages on disk, is copied into a shadow directory. The shadow directory is then saved on disk while the current directory is used by the transaction.

v. During transaction execution, the shadow directory is never modified. When a write_item operation is performed, a new copy of the modified database page is created, but the old copy of that page is not overwritten.

vi. Instead, the new page is written elsewhere, on some previously unused disk block. The current directory entry is modified to point to the new disk block, whereas the shadow directory is not modified and continues to point to the old unmodified disk block.

3. Comparison:

i. The difficulties with log based approach are as follows:

  • The search process is time consuming.
  • Most of the transactions that, according to our algorithm, need to be redone have already written their updates into the database. Although redoing them will cause no harm, it will nevertheless cause recovery to take longer.

ii. In shadow paging system, the overhead of log-record output is eliminated, and recovery from crashes is significantly faster since no undo or redo operations are needed.

iii. The commit of a single transaction using shadow paging requires multiple blocks to be output:

  • The actual data blocks
  • The current page table
  • The disk address of the current page table.

Log-based schemes need to output only the log records, which, for typical small transactions, fit within one block.

iv. Locality is an important factor which needs to be considered in recovery techniques.

v. Locality can be defined as the process of keeping related database pages close physically on the disk.

vi. Shadow paging causes database pages to change location when they are updated. Hence, the locality property of the pages is lost.

vii. This results in the usage of complex, higher overhead schemes for physical storage management in shadow paging as compared to log based recovery.

viii. Also, garbage collection becomes necessary for shadow paging recovery system.

ix. Because, each time a transaction commits, the database pages containing the old version of data changed by the transaction become inaccessible. Such pages are considered garbage, since they are not part of free space and do not contain usable information.

x. Garbage may be created also as a side effect of crashes. Periodically, it is necessary to find all the garbage pages, and to add them to the list of free pages.

xi. Thus, garbage collection in shadow paging recovery system results in additional overhead and complexity on the system.

Please log in to add an answer.