Information Technology Reference
In-Depth Information
the worst case, the buffer manager goes through the buffer sequentially and flushes
every page marked as modified onto disk. Using an average seek time of 15 ms, this
takes a total of 37.5 s. This operation slows down the normal operation of the system
and is repeated every 5 or 10 min.
The situation can be made somewhat better by ordering the pages before taking
them to disk to save in seeking the drive heads. We could also use a background
process that takes modified pages to disk, so that there would be less pages to write
when the actual checkpoint is taken.
A lighter-weight method than the complete checkpoint is to make an
indirect
checkpoint
or
fuzzy checkpoint
, where only some of the modified pages are taken
to disk. In a minimal fuzzy checkpoint, no pages are taken to disk, but copies of
the modified-page table and the active-transaction table are written to the log. (The
active-transaction table is logged so as to assist the undo pass of recovery.)
In a fuzzy checkpoint, the following is logged:
h
begin-checkpoint
i
.
h
active-transaction-table
f
.T
1
;s
1
;n
1
/;:::;.T
k
;s
k
;n
k
/
gi
.
h
modified-page-table
f
.p
1
;r
1
/;:::;.p
m
;r
m
/
gi
.
h
end-checkpoint
i
.
Here s
i
is the state of transaction T
i
(forward-rolling or backward-rolling), n
i
is the
U
NDO
-N
EXT
-LSN
of T
i
,andr
j
is the
R
EC
-LSN
of the modified page p
j
.
In a fuzzy checkpoint, no pages are necessarily forced to disk, not even pages
of the log file. When the
end-checkpoint
log record is eventually taken to disk, the
LSN
of the corresponding
begin-checkpoint
log record is written to a specific place
in stable storage.
Transactions can perform updates and produce log records freely between those
produced by the checkpoint. The modified-page table and active-transaction table
must be protected using read latches when they are written to the log.
A page that is used often and for long duration may stay in the buffer beyond
several checkpoints, which means that its
R
EC
-LSN
freezes the
R
EDO
-LSN
used as
the starting point of the redo pass. Updated pages should be taken to disk using a
background process. It is useful to mark modified pages that have not been taken
to disk after the previous checkpoint to be taken to disk during the next checkpoint
(before writing the modified-page table). In any case, it is important to make sure
that the
R
EDO
-LSN
value is advanced at every checkpoint. This can be done by
flushing onto disk a couple of modified pages with the least
R
EC
-LSN
values.
4.5
Problems with Do-Undo-Redo Recovery
The recovery algorithms used in some early database management systems such
as System R were based on the
do-undo-redo
recovery paradigm, where forward-
rolling actions of transactions were logged using redo-undo log records (the “do”
phase of transaction processing) and where, in the event of a system crash, these log