Information Technology Reference
In-Depth Information
The active-transaction table is updated while scanning the log by inserting
transaction records for transactions that begin after the start of the checkpoint (when
a log record h T; B i is encountered), and deleting records for transactions that were
committed or completed their rollback after the start of the checkpoint (when a log
record h T; C i is encountered). The U NDO -N EXT -LSN values of active transactions are
maintained accordingly.
The algorithm for the analysis pass is shown as Algorithm 4.12 . The call
analyze-log-record .r/ (Algorithm 4.13 ) updates the active-transaction table and the
modified-page table as needed by the log record r . The processing of log records
for structure modifications (in the call analyze-smo ) is discussed in Sect. 4.11 .
Algorithm 4.12 Procedure analysis-pass ./
r get-next-log-record .B EGIN -C HECKPOINT -LSN/
while r is an available log record with LSN n do
analyze-log-record .r /
r get-next-log-record .n/
end while
return R EDO -LSN D minfn j .p; R EC -LSN D n/ is in the modified-page tableg
Algorithm 4.13 Procedure analyze-log-record ./
if r is of the form “n:h active-transaction-table ;f:::gi” then
initialize the active-transaction table with the contents of r
else if r is of the form “n:h modified-page-table ;f:::gi” then
initialize the modified-page table with the contents of r
else if r is of the form “n:hT; Bi” then
insert the record .T; forward-rolling; U NDO -N EXT -LSN D n/ into the active-transaction
table
else if r is of the form “n:hT; .IjD/;p;:::i” then
U NDO -N EXT -LSN.T / n
if there is no entry for p in the modified-page table then
insert .p; R EC -LSN D n/ into the modified-page table
end if
else if r is of the form “n:hT; Ai” then
change the state of T to “backward-rolling” in the active-transaction table
else if r is of the form “n:hT; .IjD/ 1 ;p;:::;n 0 i” then
U NDO -N EXT -LSN.T / n 0
if there is no entry for p in the modified-page table then
insert .p; R EC -LSN D n/ into the modified-page table
end if
else if r is of the form “n:hT; Ci” then
delete the transaction record of T from the active-transaction table
else if r is of the form“n:hT; SŒP ; n 0 i” then
U NDO -N EXT -LSN.T / n
else if r is a log record for a structure modification then
analyze-smo .r /
end if
 
Search WWH ::




Custom Search