Lost Updates: Suppose the two transactions T3 and T4 run simultaneously and they happen to be interleaved in the following way (suppose the initial value of X as
10000):
T3
|
T4
|
Value of X
|
T3
|
T4
|
READ X
|
|
10000
|
|
|
READ X
|
|
10000
|
SUB 5000
|
|
5000
|
|
|
ADD 3000
|
|
13000
|
WRITE X
|
|
5000
|
|
|
WRITE X
|
|
13000
|
After the implementation of both the transactions the value X is 13000 whereas the semantically correct value should be 8000. The trouble occurred as the update made by T3 has been overwritten by T4. The root cause of the trouble was the fact that both the transactions had read the value of X as 10000. Therefore one of the two updates has been lost and we say that a lost update has occurred.
There is one more way in which the lost updates can happen. Consider the following part of some transactions:
T5
|
T6
|
Value of x originally
2000
|
T5
|
T6
|
UPDATE X
|
|
3000
|
|
|
UPDATE X
|
|
4000
|
ROLLBACK
|
|
2000
|
|
Here T5 & T6 updates the similar item X. After that T5 decides to undo its action and rolls back causing the value of X to go back to the original value that was 2000. In this case also the update performed by T6 had got lost and a lost update is said to have happened.