Information Technology Reference
In-Depth Information
D
Df
.0; 6/; .2; 2/; .4; 4/
g
.
A transaction of the form
T
1
D
BR
Œx
1
;>0;
u
1
RŒx
2
;>x
1
;
u
2
:::RŒ
1
;>x
n
; 0W Œ0;
v
;
P
iD1
u
i
C
is generated from the program
exec sql select sum
.V /
into
:s
from
r
where
X>0;
exec sql update
r
set
V
D
:s
where
X
D
0;
exec sql commit
,
and a transaction
T
2
D
BI
Œ1; 1I Œ3; 3RŒ0;
v
W Œ0;
v
;
v
C
4C
from the program
exec sql insert into
r
values
.1; 1/;
exec sql insert into
r
values
.3; 3/;
exec sql select
V
into
:v
from
r
where
X
D
0;
exec sql update
r
set
V
D
:v
C
4
where
X
D
0;
exec sql commit
.
Both transactions are logically consistent with respect to the integrity constraint.
The transactions exemplify a case in which one transaction (T
1
) scans a relation in
key order while simultaneously another transaction (T
2
) inserts tuples in the range
being scanned.
On the above database D, the history
T
1
:
BR
Œ2; 2
RŒ3; 3RŒ4; 4RŒ
1
; 0W Œ0; 10; 9C
T
2
:
BI
Œ1; 1I Œ3; 3RŒ0; 6W Œ0; 6; 10C
can be run on D and produces the database
D
0
Df
.0; 9/; .1; 1/; .2; 2/; .3; 3/; .4; 4/
g
,
which does not satisfy the integrity constraint. The only isolation anomaly in this
history is the unrepeatable read RŒ2; > 0; 2 by T
1
, which is of type phantom
phenomenon.
The sum calculated by T
1
includes the value of the second tuple inserted by T
2
,
but not that of the first. Accordingly, the history is neither equivalent to the serial
history T
1
T
2
D
T
1
:
BR
Œ2; 2RŒ4; 4RŒ
1
;0WŒ0;6;6C
T
2
:
BI
Œ1; 1I Œ3; 3RŒ0; 6W Œ0; 6; 10C ,
nor to the serial history T
2
T
1
D
T
1
:
BR
Œ1;1:::RŒ
1
; 0W Œ0; 10; 10C
T
2
:
BI
Œ1; 1I Œ3; 3RŒ0; 6W Œ0; 6; 10C .
Both of these serial histories produce on D the database