Give an example of a schedule at the READ COMMITTED isolation level in which a lost update occurs.
What will be an ideal response?
Suppose a transaction reads the value of an item, x, and, on the basis of the value read, writes a new value back to x. A deposit transaction in a banking system has this pattern of behavior, where x is the balance of the account being credited. At the READ COMMITTED isolation level, such a deposit transaction releases its read lock before acquiring a write lock, two deposit transactions on the same account can be interleaved as illustrated in the following schedule
r1(x) r2(x) w2(x) commit2 w1(x) commit1
The effect of T2 is lost since the value written by T1 is based on the original value of x, rather than the value written by T2. Thus if T1 was attempting to deposit |S5 and T2 was attempting to deposit |S10, the final database has only been incremented by |S5, so T2’s update has been lost.
You might also like to view...
What must a call to a member function always be preceded by?
What will be an ideal response?
When using steganography to hide messages, why is it better to change the least significant bits of an image, and how is this detected?
What will be an ideal response?