GATE / CS ARCHIVE

SIMILAR QUESTIONS / DATABASE MANAGEMENT SYSTEMS

Trace dirty reads and commit-order conditions

4 questions solved the same way, newest first. Back to Database Management Systems

How these are solved

Identify the writer of each read, then compare writer commit against the reader read/commit. Distinguish recoverable, cascadeless, strict, and conflict-serializable conditions.

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 32, GATE 2021: Schedule R1(Y),R1(X),R2(Z),R1(Y),W1(X),R2(Z),W2(Y),R3(X),W3(Z). P: conflict-serializable. Q: if T3 commits before T1 finishes, schedule is recoverable. A both; B only P; C only Q; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (2 schedules)

On Y, R1(Y) precedes W2(Y), giving T1→T2. On X, W1(X) precedes R3(X), giving T1→T3. On Z, R2(Z) precedes W3(Z), giving T2→T3. This acyclic graph has serial orderT1, T2, T3, so P is true. T3 reads X written by T1; committing T3 before T1 finishes violates recoverability. Hence Q is false and B holds.

Conflicts require the same data item, distinct transactions, and at least one write. Repeated reads of Z do not introduce a reverse edge. Serializability and recoverability are distinct: an acyclic precedence graph controls equivalent ordering of operations, whereas a reads-from dependency requires the writer to commit before its reader commits.

Original paper, page 73 · Answer key

2 marks · MCQ
Report issue

Recovery & Logging

Question 51, GATE 2016: Schedule S=r2(X);r1(X);r2(Y);w1(X);r1(Y);w2(X);a1;a2, where r,w,a mean read,write,abort. A nonrecoverable; B recoverable but cascading abort; C no cascading abort; D strict.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (10 steps)

Every read occurs before the other transaction has written the read item, so neither transaction reads uncommitted data from the other. There is therefore no read-dependency requiring a cascading abort, C. The two explicit aborts do not themselves establish a cascade. The schedule is recoverable (neither commits prematurely), but not strict because w2(X) overwrites uncommitted w1(X).

Dirty reads, dirty writes and recoverability are different conditions. Here r2(X),r1(X) occur before w1(X), and neither transaction writes Y, so all reads see previously committed values. But w2(X) occurs before T1 aborts, a dirty write, ruling out strictness. Two transactions aborting in the same schedule need not have a causal read-dependency cascade.

Original paper, page 41 · Answer key

2 marks · MCQ
Report issue

Recovery & Logging

Question 51, GATE 2015: A partial schedule lists these operations in time order: 1 T1:read(A); 2 T1:write(A); 3 T2:read(C); 4 T2:write(C); 5 T2:read(B); 6 T2:write(B); 7 T2:read(A); 8 T2:commit; 9 T1:read(B). T1 fails immediately after time 9. Which statement is correct? (A) Abort T2, then restart both T1 and T2 to ensure atomicity. (B) The schedule is non-recoverable and cannot ensure transaction atomicity. (C) Abort and restart only T2 to ensure atomicity. (D) The schedule is recoverable and ensures atomicity without doing anything else.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (12 steps)

1. T2 reads A at time 7 after T1 writes it at time 2, before T1 commits.

2. T2 then commits at 8. When T1 fails after 9, its uncommitted value has already influenced a committed transaction. This violates recoverability: a reader must not commit before the transaction whose value it read. T2 cannot simply be treated as an uncommitted transaction to roll back. Thus B.

Original paper, page 73 · Answer key

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 29, GATE 2014: Schedule S, in chronological order: T2 reads X; T3 writes X and commits; T1 writes X and commits; T2 writes Y, reads Z, and commits; T4 reads X, reads Y, and commits. Classify S. A conflict-serializable, not recoverable; B not conflict-serializable, recoverable; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (13 steps)

1. Set up the reasoning. Construct a precedence graph for conflicting operations on the same item, and separately inspect the commit order of transactions whose values are read. Serializability and recoverability are different tests.

2. Derive the result. Conflicts on X impose T2→T3→T1→T4, and Y adds T2→T4; the graph is acyclic. T2 reads initial X/Z; T4 reads X from already committed T1 and Y from already committed T2. Thus the schedule is both conflict-serializable and recoverable, C.

3. Check the interpretation. The graph order T2,T3,T1,T4 respects every conflict, including direct T2→T1 and T2→T4 edges. T4 reads only committed results, while T2 reads initial values, so there is no commit-before-writer recovery violation.

Original paper, page 36 · Answer key