16.27Explain the phantom phenomenon. Why may this phenomenon lead to an incorrect concurrent execution despite the use of the two-phase locking protocol bAnswer:bThe
phantom phenomenon arises when, due to an insertion or deletion, two transactions logically conflict despite not locking any data items in common. The insertion case is described in the book. Deletion can also lead to this phenomenon. Suppose
Tideletes
a tuple from a relation while Tjscans the relation. If
Tideletes the tuple and then
Tjreads the relation,
Tishould
be serialized before Tj. Yet there is no tuple that both
Tiand
Tjconflict on.
An interpretation of PL as just locking the accessed tuples in a relation is incorrect. There is also an index or a relation data that has information about the tuples in the relation. This information is read by any transaction that scans the relation, and modified
by transactions that update, or insert into, or delete from the relation. Hence locking must also be performed on the index or relation data, and this will avoid the phantom phenomenon.
Share with your friends: