Information Technology Reference
In-Depth Information
dirty reads, and unrepeatable reads. Without assuming any specific transaction
model, these isolation anomalies can be characterized as follows:
1. A transaction T
2
does a dirty write
if T
2
updates data items satisfying predicate
P when some data item satisfying P has an uncommitted update by another
transaction T
1
.
2. A transaction T
2
does a dirty read
if T
2
reads data items satisfying predicate
P when some data item satisfying P has an uncommitted update by another
transaction T
1
.
3. A transaction T
1
does an unrepeatable read
if T
1
reads data items satisfying
predicate P , after which another transaction T
2
updates some data item satisfying
P while T
1
is still forward-rolling. The read action by T
1
is termed unrepeatable
because repeating it after the commit of T
2
will most probably produce a different
result.
Example 5.7
The update action (W
2
Œx, I
2
Œx, D
2
Œx) by transaction T
2
is a dirty
write in the histories
B
1
:::W
1
Œx:::B
2
:::W
2
Œx:::C
1
::: ,
B
1
:::W
1
Œx:::B
2
:::D
2
Œx:::C
1
::: ,
B
1
:::I
1
Œx:::B
2
:::W
2
Œx:::C
1
::: ,
B
1
:::I
1
Œx:::B
2
:::D
2
Œx:::C
1
::: ,
B
1
:::D
1
Œx:::B
2
:::I
2
Œx:::C
1
::: ,
assuming that the update action of transaction T
1
is not undone before the update
action of T
2
. The predicate P in the definition is here “X
D
x,” where X is the
primary-key attribute.
On the other hand, the history
B
1
:::S
1
ŒP W
1
Œx:::B
2
:::A
1
ŒP:::W
1
ŒxC
1
ŒP:::W
2
Œx:::C
1
:::
does not exhibit a dirty write, because W
1
Œx is undone before W
2
Œx.
t
Example 5.8
The action R
2
Œx by transaction T
2
is a dirty read in the histories
B
1
:::W
1
Œx:::B
2
:::R
2
Œx:::C
1
::: ,
B
1
:::I
1
Œx:::B
2
:::R
2
Œx:::C
1
::: ,
assuming that the update action of transaction T
1
is not undone before the read
action of T
2
. The predicate P in the definition is “X
D
x.” The histories represent
the simple type of a dirty read in which the key read is the key that has the
uncommitted update.
t
Example 5.9
The action R
2
Œx; >
z
by transaction T
2
is a dirty read in the history
B
1
:::D
1
Œy:::B
2
:::R
2
Œx; >
z
:::C
1
::: ,
if x>y>
z
, assuming that the delete action of transaction T
1
is not undone before
the read action of T
2
. The predicate P in the definition is “x
X>
z
.”
The above history exhibits a dirty read of type
phantom phenomenon
. The tuple
with key y that disappears from the key range .
z
;x due to the delete action by T
1
is called a
phantom tuple
.
t