edited by
21,853 views
64 votes
64 votes

Consider the following database schedule with two transactions $T_{1}$ and $T_{2}$.

$S= r_{2}\left(X\right); r_{1}\left(X\right); r_{2} \left(Y\right); w_{1} \left(X\right); r_{1} \left(Y\right); w_{2} \left(X\right); a_{1}; a_{2}$

Where $r_{i} (Z)$ denotes a read operation by transaction $T_{i}$ on a variable $Z$, $w_{i}(Z)$ denotes a write operation by $T_{i}$ on a variable $Z$ and $a_{i}$ denotes an abort by transaction $T_{i}$.

Which one of the following statements about the above schedule is TRUE?

  1. $S$ is non-recoverable.
  2. $S$ is recoverable, but has a cascading abort.
  3. $S$ does not have a cascading abort.
  4. $S$ is strict.
edited by

6 Answers

Best answer
74 votes
74 votes

Answer is C

$${\begin{array}{|c|c|}\hline
\textbf{T1}&    \textbf{T2} \\\hline  & \text{R(x)} \\
     \text{R(x)} \\   &      \text{R(y)} \\    
\text{W(x)}&     \\ \text{R(y)} \\ & \text{W(x)} \\ \text{a1} \\ &      \text{a2} \\     \hline
\end{array}}$$

(A): This is not possible, because we have no dirty read ! No dirty read $\implies$ Recoverable

(B): This is not possible, because of no Dirty read ! No dirty read $\implies$ No cascading aborts !

(D): This is not true, because we can see clearly in image that after W1(X) before T1 commit or aborts T2 does W2(x) !

C is only option remaining !

edited by
6 votes
6 votes
option (c). No cascading rollback. Because no dirty read.
6 votes
6 votes

A) False because at a1 it aborts and a2 is still to be executed, therefore it's recoverable!  It would only be non recoverable if the abort happens after either T1 or  T2 commits. 

B) To check for cascading aborts - First check if it's Cascadeless b/c Any Schedule which is NOT cascadeless is cascading aborts.

Now, Necessary condition for Cascadeless is - Producer - Consumer  ie (W-R) conflict but there's no PC (W-R conflict) in here. Therefore it's Cascadeless and a Cascadeless schedule can never be Cascading aborts!

Note: Every cascadeless schedule is recoverable always! Foolproof option A)

C) True as reason as B) 

D) False as before T2 commits, T1 is reading as well as writing! 

edited by
1 votes
1 votes
option c is correct the above schedule does not have cascading aborts.

Cascading aborts occurs only when there is a write by $T_i$ on data item x followed by read operation on  the same data item by $T_j$

but here $T_1$ performs $w_1$(x) which is no where followed by $r_2$(x).

See carefully  $w_1$(x) is followed by  $w_2$(x). write operation by two transactions on same data item is allowed in cascadeless schedules.

Hence the above schedule is cascadeless.
Answer:

Related questions

56 votes
56 votes
1 answer
2
Akash Kanase asked Feb 12, 2016
11,017 views
Consider the following database table named water_schemes:$$\overset{\text{Water_schemes}}{\begin{array}{|c|c|c|}\hline\textbf{scheme_no}& \textbf{district_name}& \te...