retagged by
6,940 views
13 votes
13 votes

​​​​​Let $S$ be the following schedule of operations of three transactions $T_1$, $T_2$ and $T_3$ in a relational database system:

$$R_2(Y), R_1(X), R_3(Z), R_1(Y)W_1(X), R_2(Z), W_2(Y), R_3(X), W_3(Z)$$

Consider the statements $P$ and $Q$ below:

  • $P$: $S$ is conflict-serializable.
  • $Q$: If $T_3$ commits before $T_1$ finishes, then $S$ is recoverable.

Which one of the following choices is correct?

  1. Both $P$ and $Q$ are true
  2. $P$ is true and $Q$ is false
  3. $P$ is false and $Q$ is true
  4. Both $P$ and $Q$ are false
retagged by

2 Answers

Best answer
14 votes
14 votes

$$\small \begin{array}{|c|c|c|}\hline T_{1} & T_{2} & T_{3} \\\hline  & R(Y) & \\ R(X) & &\\&& R(Z) \\ R(Y) & & \\ W(X) & & \\ & R(Z) & \\ & W(Y) & \\ & & R(X) \\ & & W(Z) \\ \hline\end{array}$$

  • $T_{1} \rightarrow T_{2}$ due to $R_1(Y)$ being before $W_2(Y)$
  • $T_{1} \rightarrow T_{3}$ due to $W_1(X)$ being before $R_3(X)$
  • $T_{2} \rightarrow T_{3}$ due to $R_2(Z)$ is being $W_3(Z)$ in the schedule.

There are no other conflicts and the discovered conflicts are not forming the cycle.

Therefore, the given schedule is Conflict Serializable.

Statement $Q:$ If $T_{3}$ commits, before $T_{1}$ finishes, then $S$ is recoverable.

Schedule S is recoverable, if Tj creating the dirty read by reading the written data by Ti and Tj commits after Ti commits.

 By the above definition, $Q$ is wrong.

Option B is correct.

edited by
2 votes
2 votes

B

Given Transactions written in tabular form,

$\hspace{125pt}\begin{array}{|c|c|c|}\hline T_1&T_2&T_3\\\hline &R(Y) \\R(X) \\&&R(Z) \\R(Y) \\W(X) \\&R(Z) \\&W(Y) \\&&R(X) \\&&W(Z) \\\hline \end{array}$

Precedence graph for the same,

                                                     

From the above, we can infer that the above schedule in conflict-serializable.

For commit operations, $T_1$ & $T_2$ must commit before $T_3$ which can be inferred from the above too.

Why since, if $T_3$ commits before $T_1$ and $T_1$ suddenly does an abort it would be as if $T_3$ was a successful transaction but in reality all it’s changes would be swept away by $T_1$’s rollback operations.

Answer:

Related questions