Information Technology Reference
In-Depth Information
database disk
log disk
n 1
n 2
n 3
n 4
n 5
update on
q
page p
Page -LSN=
page q
Page -LSN=
update on
p
checkpoint
update on p
commit
n 2
n 1
fix page
flush page
flush
log
page p
Page -LSN= n 4
database buffer
log buffer
Fig. 2.4
Database state restored (redone) after a system crash
contains all the updates logged with LSN s n 1 , n 6 ,andn 8 , while the disk version of
q does not contain the two last updates.
Assume now that the system crashes. The contents of main memory, including
the database and log buffers, are then lost. In restart recovery, the database is restored
to the state that existed at the time the most recent log record surviving on the log
disk was written. This is done by applying logged updates onto the disk versions of
pages. Thus, the disk version of page p is fetched from disk and fixed in the buffer,
the update logged with LSN n 4 is redone on the buffered page, the P AGE -LSN of the
page is advanced to n 4 , and the page is unfixed (Fig. 2.4 ). No page is flushed onto
disk; so the disk version of the database remains unchanged. The recovery is then
continued with aborting and rolling back the active transactions, that is, those that
have no commit log record on the log disk.
t
2.6
Integrity of the Physical Database
The physical database (more properly, its state) is integral or consistent when the
internal data structures in all its pages are consistent and the collection of pages
makes up a valid graph structure of the type specified by the file structure. For
 
Search WWH ::




Custom Search