Consider a simple checkpointing protocol and the following set of operations…
2015
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?
Answer: A. Undo: T3, T1; Redo: T2 — Key insight: transactions that committed after the checkpoint must be redone; transactions that were active at crash and not committed must be undone. At…
- A.
Undo: T3, T1; Redo: T2
- B.
Undo: T3, T1; Redo: T2, T4
- C.
Undo: none; Redo: T2, T4, T3, T1
- D.
Undo: T3, T1, T4; Redo: T2
Attempted by 80 students.
Show answer & explanation
Correct answer: A
Key insight: transactions that committed after the checkpoint must be redone; transactions that were active at crash and not committed must be undone.
At checkpoint: T1 was active (not committed). T4 had already committed before the checkpoint.
After checkpoint (before crash): T2 started, wrote, and committed; T3 started and wrote but did not commit.
Redo list: include transactions that committed after the checkpoint — here, T2.
Undo list: include transactions active at crash that did not commit — here, T3 and T1.
Final result: Undo list = T3, T1. Redo list = T2.
A video solution is available for this question — log in and enroll to watch it.