Database Reference
In-Depth Information
Page 8
(new)
Current
Directory
Shadow
Directory
Page 4
Page 2
Page 7
(old)
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
Page 5
Page 1
Page 7
(new)
Page 3
Page 8
(old)
Pages 7 & 8 updated
Not updated
Page 6
Figure 15-30
Example of shadow paging.
Transaction Execution Let us illustrate the concept of database pages and the
two directories. Figure 15-30 shows an example of shadow paging. Refer to the
figure and follow the actions during transaction execution.
Here is the list of actions:
Transaction starts execution.
Current directory is copied to shadow directory.
During transaction execution shadow directory is not modified.
Transaction performs a write operation (say to page 7 and 8 of the database).
Disk pages (page 7 and 8) are copied to unused disk pages.
Update is performed in the new disk pages.
Current directory is modified to point to new disk pages.
Shadow directory still points to the old disk pages.
To commit the transaction:
Ensure that all buffer pages in main memory changed by the transaction are
written to disk.
Write current page table to disk.
Change disk address of the shadow directory to that of the current directory.
Recovery Let us say that a failure occurred during the execution of the above
transaction. During execution, the shadow directory still points to the prior status
of the database pages. The following actions are taken for recovery:
Discard the current directory.
Free the modified pages.
Reinstate the shadow directory as the current directory.
Search WWH ::




Custom Search