Information Technology Reference
In-Depth Information
4.4
Checkpoints
When using the no-force buffering policy, there may be many pages in the buffer that
are never taken to disk due to their high access rate. These pages can accumulate
many updates by committed transactions. Thus, the disk versions of these pages
may get well out of date: the P AGE -LSN of the disk version can be much less than the
LSN of the latest update on the page (i.e., the P AGE -LSN of the buffer version).
In this situation, the R EC -LSN values of the modified-page table point to early
locations in the log. This also means that the point where the recovery process starts
reading the log is far from the end: the recovery process starts from the R EDO -LSN ,
which is at the minimum of the R EC -LSN s or earlier. Thus, a lot of time is used for
the redo actions.
The recovery process can be made faster by taking checkpoints every now and
then (typically at 5-10 min intervals). A complete checkpoint can be taken as shown
in Algorithm 4.11 . The call
flush-onto-disk .p/
takes page p onto disk according to the WA L protocol (so that the log is first flushed)
and marks page p as unmodified by clearing the modified bit in the buffer control
block of p.
Algorithm 4.11 Procedure take-complete-checkpoint ./
log .n;h begin-complete-checkpoint i/
for every page p with an entry in the modified-page table do
fix-and-read-latch .p/
flush-onto-disk .p/
delete the entry for p from the modified-page table
unlatch-and-unfix .p/
end for
log .n 0 ;h end-complete-checkpoint i/
flush-the-log ./
store B EGIN -C HECKPOINT -LSND n at a certain place on disk
Normal transaction processing can continue in parallel with taking a checkpoint.
During taking the checkpoint new insertions into the modified-page table and the
active-transaction table can occur; these are possibly not included in the logged
tables.
The R EDO -LSN value used as the starting point of the redo pass can be set to the
LSN of the begin-complete-checkpoint log record of the last checkpoint that was
completely done (i.e., whose end-complete-checkpoint record is found in the log).
Taking a complete checkpoint can be an expensive operation, and it can slow
down normal transaction processing considerably. For instance, let the size of the
buffer be 5,000 pages of 8 kilobytes each. Assume that 50% of the pages have been
updated when the checkpoint is taken. Then we need to take 2,500 pages to disk. In
 
Search WWH ::




Custom Search