Question
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?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2015 answer key
Solution
Follow the standard database crash recovery rules for immediate-update logging with checkpoints.
Log contents:
(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)
CRASH
Recovery algorithm:
- Undo List: Transactions that were active (started but never committed) at the time of the crash.
- started before the checkpoint and did not commit .
- started after the checkpoint and did not commit .
Undo list = .
- Redo List: Transactions that committed after the checkpoint, or were active at checkpoint and subsequently committed.
- committed before the checkpoint; its changes were already flushed to disk at checkpoint not in Redo list.
- started after the checkpoint and successfully committed .
Redo list = .
Contents: Undo: ; Redo: (option A).
A
Adding to the Redo list, ignoring that it already committed before the checkpoint.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 2
- Question
- 56 of 65, printed as CS Q.46
- 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.