Machine-translated by Google. Questions are authored in English.
Top

Discussion

A schedule of three database transactions \(T_{1}\), \(T_{2}\), and \(T_{3}\) is shown. \(R_{i}(A)\) and \(W_{i}(A)\) denote read and write of data item \(A\) by transaction \(T_{i}\), \(i = 1,2,3\). The transaction \(T_{1}\) aborts at the end. Which other transaction(s) will be required to be rolled back?

\(R_{1}(X)\ W_{1}(Y)\ R_{2}(X)\ R_{2}(Y)\ R_{3}(Y)\ ABORT(T_{1})\)

  • A.Only \(T_{2}\)
  • B.Only \(T_{3}\)
  • C.Both \(T_{2}\) and \(T_{3}\)
  • D.Neither \(T_{2}\) nor \(T_{3}\)

Answer: C

The transactions to roll back are Both \(T_{2}\) and \(T_{3}\).

\(T_{1}\) writes Y, and then \(T_{2}\) reads Y and \(T_{3}\) reads Y before \(T_{1}\) finishes. Both have read a value written by an uncommitted transaction (a dirty read). When \(T_{1}\) aborts, its write to Y is undone, so the values \(T_{2}\) and \(T_{3}\) read never officially existed and both must be rolled back too: a cascading rollback.

\(T_{2}\)'s read of X does not matter, because \(T_{1}\) only read X and did not write it. Since each of \(T_{2}\) and \(T_{3}\) depends on \(T_{1}\)'s write of Y, 'only one of them' and 'neither' are both wrong.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.