Information Technology Reference
In-Depth Information
10.6
Logging and Undoing Bulk Actions
In Algorithm 10.2 , tuples from a bulk are inserted into leaf page p using the
call insert-bulk-into-page .T;p;S/, which could be implemented by calling insert-
into-page .T;p;x; v / (Algorithm 3.1 ) on all tuples .x; v / in S . In Algorithm 10.3 ,
tuples are deleted from leaf page p using the call delete-bulk-from-page .T;p;S/,
which could similarly be implemented by calling delete-from-page .T;p;x/(Algo-
rithm 3.2 ) on the keys x of tuples in S . The log then shows just an expanded
history of tuple-wise actions, which can be undone, if so needed, by the proce-
dures undo-insert .n;T;p;x;n 0 / (Algorithm 4.7 )and undo-delete .n;T;p;x; v ;n 0 /
(Algorithm 4.9 ).
To save in the number of assignments of the P AGE -LSN of the page to be updated
and of the U NDO -N EXT -LSN of the transaction, we can use Algorithm 10.4 to insert
the tuples in S into page p and Algorithm 10.5 to delete the tuples in S from page
p. These algorithms log the tuple-wise actions as in insert-into-page .T;p;x; v / and
delete-from-page .T;p;x; v /, but only the LSN of the last tuple-wise update needs to
be stamped into the P AGE -LSN of page p.
Algorithm 10.4 Procedure insert-bulk-into-page .T;p;S/
n 0 U NDO -N EXT -LSN.T /
for all tuples .x; v / 2 S do
insert .x; v / into page p
log .n;hT; I; p; x; v ;n 0 i/
n 0 n
end for
P AGE -LSN.p/ n
U NDO -N EXT -LSN.T / n
Algorithm 10.5 Procedure delete-bulk-from-page .T;p;S/
n 0 U NDO -N EXT -LSN.T /
for all tuples .x; v / 2 S do
delete .x; v / from page p
log .n;hT; D; p; x; v ;n 0 i/
n 0 n
end for
P AGE -LSN.p/ n
U NDO -N EXT -LSN.T / n
 
Search WWH ::




Custom Search