Information Technology Reference
In-Depth Information
...
a
log record being scanned:
n
:
...,p,...
...
Rec-LSN( p ) −ₒ n 1 :
...,p,...
...
Page -LSN( p ) −ₒ n 2 :
...,p,...
...
n< Rec-LSN(
p
): page
p
need not be fixed and latched.
...
b
Rec-LSN(
p
)
−ₒ n 1 :
...,p,...
...
log record being scanned:
n :
...,p,...
...
Page -LSN(
p
)
−ₒ n 2 :
...,p,...
...
n ≥ Rec-LSN( p ): page p has to be fixed and latched, but the update must not
be redone, because
n ≤ Page -LSN(
p
).
...
c
Rec-LSN( p ) −ₒ n 1 :
...,p,...
...
Page -LSN(
p
)
−ₒ n 2 :
...,p,...
...
log record being scanned:
n :
...,p,...
...
has to be fixed and latched, and the update has to be
redone, because n> Page -LSN( p ).
n ≥ Rec-LSN(
p
): page
p
Fig. 4.4
Different scenarios in the redo pass
p does not need to be fixed and write-latched again when processing any further log
records for updates on p with LSN slessthan P AGE -LSN .p/ C 1. Moreover, if another
recovery needs to be started soon after this one, its redo pass will be faster, since the
checkpoint taken at the end of the recovery will have a copy of the modified-page
table with more up-to-date R EC -LSN s.
The normal steal-and-no-force policy is followed during the redo pass. As the
redo pass starts with an empty database buffer, no pages need to be flushed onto
disk if all the pages that need redoing fit in the buffer at the same time. In this
case the disk version of the database remains as it was at the time of the crash,
and the redone updates appear only in the buffer version of the database resulting
from the redo pass. However, if a page is flushed onto disk during the redo pass, its
entry is deleted from the modified-page table (as is done during normal processing),
and if an update on that page is encountered in the redo pass when scanning a log
record with LSN n, then an entry for the page with R EC -LSN D n is inserted into the
modified-page table.
Nothing is written to the log during the redo pass. This is because actions are
always redone physically on the same pages (and even in the same record positions)
where they were originally done, and thus the records already in the log describe the
redo actions exactly. As all the surviving log records are on the log disk and no new
log records are generated, the log buffer remains empty during the redo pass. Thus,
the write-ahead-logging protocol need not be followed during the redo pass.
Search WWH ::




Custom Search