CS FundamentalsVery hardProduct company interview · GATE level

No transaction has committed yet in the schedule W1(A); R2(A); W2(B); R3(B); W4(B); R5(B). T1 now aborts. Besides T1, which transactions must be rolled back?

  1. A. T2, T3 and T5
  2. B. T2 only
  3. C. T2, T3, T4 and T5
  4. D. T2 and T3

Correct answer: D. T2 and T3

A transaction must be rolled back if it read a value written by a transaction that is being rolled back. T2 read A from T1, so T2 goes. T3 read B from T2, so T3 goes as well - a cascade. T4 only wrote B without reading anything, so it depends on no one, and T5 read B after T4's write, so it saw T4's value, not T2's. T4 and T5 survive. Rolling back T5 confuses 'read the item B' with 'read T2's version of B'.

More DBMS and SQL questions

Exams that ask this topic