Information Technology Reference
In-Depth Information
Algorithm 13.8
Tracking updates from the primary database system
r the next log record from the primary system
while
r is a log record with LSN n
do
r r with its U
NDO
-N
EXT
-LSN, if any, replaced with the mapped LSN
if
r is other than a buffering-specific log record
then
log
.n
0
;r/
insert .n; n
0
/ to the primary-to-backup LSN mapping
if
r describes updates on some pages
then
for
each updated-page page-id p in r
do
append the log record r with LSN n
0
to work queue h.p/
end for
else if
r is a transaction-control-action log record for transaction T
then
if
r is a commit-transaction log record
then
flush-the-log
./
remove the record of T from the active-transaction table
else
{r is a begin-transaction, abort-transaction, set-savepoint, rollback-to-savepoint or
complete-rollback-to-savepoint log record}
update the record of T in the active-transaction table
end if
end if
end if
r the next log record from the primary system
end while
Algorithm 13.9
Processing work queue
w
r the first record on work queue
w
while
r is a log record with backup-LSN n
do
W
ORK
-Q
UEUE
-R
EC
-LSN.
w
/ n
if
r describes updates on pages p
1
;:::;p
k
then
for
all i D 1;:::;k
do
if
h.p
i
/ D
w
and
R
EC
-LSN.p
i
/ n
then
fix-and-write-latch
.p
i
/
if
page p
i
is unmodified
then
R
EC
-LSN.p
i
/ P
AGE
-LSN.p
i
/C1
end if
if
P
AGE
-LSN.p
i
/<n
then
apply the update described by r on page p
i
P
AGE
-LSN.p
i
/ n
end if
unlatch-and-unfix
.p
i
/
end if
end for
end if
remove r from work queue
w
r the first record on work queue
w
end while