Information Technology Reference
In-Depth Information
Algorithm 15.3 Procedure relocate-and-flush-pages .M /
P ;
for all buffer control blocks b in the LRU chain do
q page-id .b/
if modified-bit .b/ D 1 and page q is unlatched then
fix-and-write-latch .q/
p parent-link .q/
if q is a B-tree page and p 6D null and page p is buffered and unlatched then
fix-and-write-latch .p/
if p and q are pages of the same B-tree and p contains an index record .x; q/ for child
q then
q 0 new page-id
P P [f.p;x;q;q 0 /g
if jPjM then
exit from the for loop
end if
else
parent-link .q/ null
unlatch-and-unfix .p/
unlatch-and-unfix .q/
end if
else
unlatch-and-unfix .q/
end if
end if
end for
for all .p;x;q;q 0 / 2 P do
stamp q 0 in the header of page q
parent-link .q 0 / p
change the buffer control block of page q to that of q 0
change the write latch on page q to that on q 0
end for
n D maxfP AGE -LSN.q 0 / j .p;x;q;q 0 / 2 Pg
flush all the not-yet-flushed log records up to and including that with LSN n
flush the pages q 0 with .p;x;q;q 0 / 2 P using a single disk write
if the disk write succeeded then
for all .p;x;q;q 0 / 2 P do
b 0 the buffer control block of page q 0
modified-bit .b 0 / 0
delete the entry for q from the modified-page table
replace the index record .x; q/ in page p by .x; q 0 /
log .n;h page-id-change ;p;x;q;q 0 i/
P AGE -LSN.p/ n
unlatch-and-unfix .q 0 /
end for
unlatch-and-unfix .p/ for all p with some .p;x;q;q 0 / 2 P
else
invalidate the pages q with .p;x;q;q 0 / 2 P and initialize redo recovery for them
end if
 
Search WWH ::




Custom Search