Consider a simple checkpointing protocol and the following set of operations in the log. (start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7); (checkpoint); (start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2); If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?

Consider a simple checkpointing protocol and the following set of operations in the log. (start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7); (checkpoint); (start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2); If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list? Correct Answer Undo: T3, T1; Redo: T2

Concept:

Check pointing is a mechanism where all the previous logs are removed from the system and stored permanently in the storage disk. Checkpoint declares a point before which the DBMS was in consistent state, and all the transactions were committed.

It maintains two list - undo list and redo list.

  • If the recovery system sees a log with <Tn, start> and <Tn, commit> or just <Tn, commit> , it puts the transaction in the redo list.

  • If the recovery system sees a log with <Tn, start> but no commit or abort log found, it puts the transaction in undo list.

Explanation:

Above operation are shown in table as:

T1

T2

T3

T4

 

 

 

start

 

 

 

write(y,2,3)

start

 

 

 

 

 

 

commit

write(z,5,7)

 

 

 

Checkpoint

Checkpoint

Checkpoint

Checkpoint

 

start

 

 

 

write(x,1,9)

 

 

 

commit

 

 

 

 

start

 

 

 

write(z,7,2)

 

crash

crash

crash

crash

 

Now, as T1 and T3 are uncommitted, they must be undone. T2 is committed but it is after checkpoint so, it must be redone. As, T4 is already committed before checkpoint so, it neither comes in undo list nor in redo list.

Related Questions

Consider a transaction T1 that committed prior to checkpoint. The record appears in the log before the record. Any modifications made by T1 must have been written to the stable storage either with the checkpoint or prior to it. Thus at recovery time ____________
Consider the following schedule S of transactions T1, T2, T3, T4: T1 T2 T3 T4   Reads(X)         Writes(X) Commit   Writes(X)  Commit         Writes(Y) Reads(Z) Commit           Reads(X) Reads(Y) Commit   Which one of the following statements is CORRECT?