Information Technology Reference
In-Depth Information
The execution of the
SQL
statement
rollback to savepoint
P in transaction T is
similar (Algorithm
4.4
), but it starts with logging a begin-rollback-to-savepoint log
record (Algorithm
4.5
), traverses the
U
NDO
-N
EXT
-LSN
chain back to the set-savepoint
action (cf. Algorithm
4.3
), and finishes the rollback with logging a complete-
rollback-to-savepoint log record (Algorithm
4.6
).
Algorithm 4.3
Procedure
set-savepoint
.T; P /
n
0
U
NDO
-N
EXT
-LSN.T /
log
.n;hT; SŒP ; n
0
i/
U
NDO
-N
EXT
-LSN.T / n
Algorithm 4.4
Procedure
rollback-to-savepoint
.T; P /
begin-rollback-to-savepoint
.T; P /
r
get-log-record
.U
NDO
-N
EXT
-LSN.T //
while
r is not “n WhT; SŒP ; n
0
i”
do
if
r is “n WhT; I; p; x;
v
;n
0
i”
then
undo-insert
.n;T;p;x;n
0
/
else if
r is “n WhT; D; p; x;
v
;n
0
i”
then
undo-delete
.n;T;p;x;
v
;n
0
/
else if
r is “n WhT; SŒP
0
; n
0
i”forsomeP
0
6D P
then
U
NDO
-N
EXT
-LSN.T / n
0
end if
r
get-log-record
.U
NDO
-N
EXT
-LSN.T //
end while
complete-rollback-to-savepoint
.T; P /
Algorithm 4.5
Procedure
begin-rollback-to-savepoint
.T; P /
log
.n;hT; AŒP i/
Algorithm 4.6
Procedure
complete-rollback-to-savepoint
.T; P /
log
.n;hT; CŒP i/