Information Technology Reference
In-Depth Information
B
I
[
x
1
,v
1
]
S
[
P
1
]
B
I
[
x
2
,v
2
]
S
[
P
2
]
I
[
x
1
,v
1
]
S
[
P
1
]
I
[
x
3
,v
3
]
I
[
x
2
,v
2
]
I
[
x
4
,v
4
]
A
[
P
2
]
B
I
−
1
[
x
3
,v
3
]
I
[
x
1
,v
1
]
I
≡
A
[
P
1
]
≡
C
P
2
]
I
[
x
4
,v
4
]
[
[
x
5
,v
5
]
I
−
1
[
x
4
,v
4
]
I
−
1
[
x
2
,v
2
]
C
A
[
P
1
]
C
P
1
]
I
[
x
5
,v
5
]
[
I
−
1
[
x
4
,v
4
]
I
−
1
[
x
2
,v
2
]
C
C
[
P
1
]
I
[
x
5
,v
5
]
C
Fig. 1.2
Nested partial rollbacks. Action SŒP sets savepoint P , and partial rollback to P is begun
by action AŒP and completed by action CŒP. Rolled-back segments of the transaction are shown
indented
. Because of the rollbacks, the overall effect on the logical database is the same as that of
the transaction BI Œx
1
;
v
1
I Œx
5
;
v
5
C
7. SŒP:
set savepoint
P .
8. AŒP :
begin partial rollback to savepoint
P .
9. CŒP:
complete the partial rollback to savepoint
P .
Now in the forward-rolling phase B˛ of a transaction, string ˛ may contain set-
savepoint actions SŒP, completed rollbacks SŒP:::AŒP:::CŒP, and maybe
one initialized but not yet completed partial rollback SŒP:::AŒP:::. Formally,
the
forward-rolling phase
of a transaction can now be of any of the following three
forms:
(a) A sequence ˛ of actions R, I , D, W ,andS
(b) An action sequence of form ˛S ŒP LJAŒP LJ
1
CŒP,where˛, LJ,and are of
form (a) or (b)
(c) An action sequence of form ˛S ŒP LJıAŒP ı
1
,where˛, LJ,andı are of form
(a) or (b)
In case (b) the subsequence S ŒP LJAŒP LJ
1
CŒP represents a completed partial
rollback to savepoint P . In case (c) the subsequence SŒPLJıAŒPı
1
indicates that
the transaction is rolling back to savepoint P .
The
undo sequence
for ˛, denoted ˛
1
or
undo
.˛/, is now defined depending on
its form: For a sequence ˛ of form (a), the undo sequence ˛
1
is defined as before.
For a sequence of form (b), the undo sequence is
1
˛
1
. For a sequence of form
(c), the undo sequence is LJ
1
CŒP˛
1
.
Savepoints and partial rollbacks constitute an important database programming
paradigm: transactions can be programmed freely to update the database imme-
diately even if some subsequent event forces the update to be rolled back and