Question

Let SS be the following schedule of operations of three transactions T1T_1, T2T_2 and T3T_3 in a relational database system:

R2(Y),R1(X),R3(Z),R1(Y),W1(X),R2(Z),W2(Y),R3(X),W3(Z)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 PP and QQ below:

PP: SS is conflict-serializable.

QQ: If T3T_3 commits before T1T_1 finishes, then SS is recoverable.

Which one of the following choices is correct?

Choose one option
Official answer and solution
Official answer
B
From
Official GATE 2021 answer key

Solution

Build the serialization graph to test conflict serializability, and examine read-write dependencies across transactions to test recoverability.

The schedule is:

S:R2(Y),R1(X),R3(Z),R1(Y),W1(X),R2(Z),W2(Y),R3(X),W3(Z)S: 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)

Testing Statement P (Conflict Serializability):
Find all conflicting operations between distinct transactions:

  • Variable YY: R1(Y)R_1(Y) precedes W2(Y)  ⟹  T1→T2W_2(Y) \implies T_1 \to T_2.
  • Variable XX: W1(X)W_1(X) precedes R3(X)  ⟹  T1→T3R_3(X) \implies T_1 \to T_3.
  • Variable ZZ: R2(Z)R_2(Z) precedes W3(Z)  ⟹  T2→T3W_3(Z) \implies T_2 \to T_3.
    The edges in the precedence graph are T1→T2T_1 \to T_2, T1→T3T_1 \to T_3, and T2→T3T_2 \to T_3. The graph has no cycles (topological sort order: T1,T2,T3T_1, T_2, T_3). Hence, SS is conflict-serializable. Statement PP is true.

Testing Statement Q (Recoverability):

  • In schedule SS, transaction T3T_3 reads XX after T1T_1 writes XX (W1(X)W_1(X) followed by R3(X)R_3(X)). Thus, T3T_3 reads uncommitted data from T1T_1 (a dirty read dependency).
  • In a recoverable schedule, for any transaction TjT_j that reads a value written by TiT_i, TiT_i must commit before TjT_j commits.
  • Statement QQ states: 'If T3T_3 commits before T1T_1 finishes, then SS is recoverable'. If T3T_3 commits before T1T_1 finishes, and then T1T_1 subsequently aborts, T3T_3 has committed using aborted data and cannot be rolled back, making the schedule unrecoverable. Hence, statement QQ is false.

Therefore, PP is true and QQ is false, which matches option B.

Final answer

B

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2021 Computer Science and Information Technology - Session 2 (CS2)
Question
42 of 65, printed as CS Q.32
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.