Database Systems · ARIES Analysis Pass, Crash During Undo, Redo-Only Logs and Media Recovery
Worked ARIES Analysis pass
2.1 The log
A checkpoint is taken at LSN 50. Its snapshot:
- TT at checkpoint: T1 (lastLSN 40, active), T2 (lastLSN 30, active)
- DPT at checkpoint: P1 (recLSN 20), P3 (recLSN 10)
Log after the checkpoint (all LSNs are byte offsets; prevLSN shown in parentheses):
LSN Record
50 Checkpoint (TT: T1@40, T2@30 ; DPT: P1@20, P3@10)
60 Update T1 P5 prev=40
70 Update T3 P1 prev=0 <- T3 starts here
80 Commit T2 prev=30
90 Update T1 P3 prev=60
100 Update T3 P5 prev=70
110 Update T1 P1 prev=90
120 Commit T1 prev=110
130 Update T3 P3 prev=100
140 End T2 prev=80
150 Update T3 P1 prev=130
160 <CRASH>
2.2 Analysis, record by record
Initialize TT and DPT from the checkpoint snapshot:
- TT: T1 (lastLSN 40, active), T2 (lastLSN 30, active)
- DPT: P1 (recLSN 20), P3 (recLSN 10)
Now scan forward from LSN 50:
| LSN | Record | Action on TT | Action on DPT |
|---|---|---|---|
| 60 | Update T1 P5 | T1.lastLSN = 60 | P5 not present → add P5 (recLSN 60) |
| 70 | Update T3 P1 | T3 not in TT → add T3 (lastLSN 70, active) | P1 already present → no change (keep recLSN 20) |
| 80 | Commit T2 | T2.lastLSN = 80, T2.status = committed | — |
| 90 | Update T1 P3 | T1.lastLSN = 90 | P3 already present → no change (recLSN 10) |
| 100 | Update T3 P5 | T3.lastLSN = 100 | P5 already present → no change (recLSN 60) |
| 110 | Update T1 P1 | T1.lastLSN = 110 | P1 present → no change (recLSN 20) |
| 120 | Commit T1 | T1.lastLSN = 120, T1.status = committed | — |
| 130 | Update T3 P3 | T3.lastLSN = 130 | P3 present → no change (recLSN 10) |
| 140 | End T2 | T2 finished → remove T2 from TT | — |
| 150 | Update T3 P1 | T3.lastLSN = 150 | P1 present → no change (recLSN 20) |
| 160 | CRASH | — | — |
Final Analysis output:
- TT: T1 (lastLSN 120, committed), T3 (lastLSN 150, active). (Full ARIES then writes an
Endrecord for committed T1 and removes it; T3 is the only loser.) - DPT: P1 (recLSN 20), P3 (recLSN 10), P5 (recLSN 60)
- Winners: T1, T2 (committed). Losers: T3 (active at crash).
2.3 Redo
Redo starts at min(recLSN) over DPT = min(20, 10, 60) = 10. Replay every update and CLR record from LSN 10 onward (including the update records at LSN 10, 20 and any others between 10 and 50 that lie before the checkpoint and are not shown), then 60, 70, 90, 100, 110, 130, 150. Each is applied only if its page is in the DPT, LSN >= recLSN(page) and pageLSN < LSN. We have no pageLSN values here, so the exam answer is: redo begins at LSN 10. Commit/End records change no page; update records and CLRs do.
Exam one-liner: Redo start LSN =
min(recLSN)over the DPT. Here = 10.
2.4 Undo
Losers = {T3}. Undo in descending LSN order, following prevLSN:
- T3.lastLSN = 150 → undo Update T3 P1 (prev 130). Write CLR at 170 with
undoNextLSN = 130. - Next = 130 → undo Update T3 P3 (prev 100). CLR at 180,
undoNextLSN = 100. - Next = 100 → undo Update T3 P5 (prev 70). CLR at 190,
undoNextLSN = 70. - Next = 70 → undo Update T3 P1 (prev 0). CLR at 200,
undoNextLSN = 0. undoNextLSN = 0→ T3 fully undone → write End T3 at 210.
Answer: T3 is rolled back with 4 CLRs (LSN 170–200) and End at 210. (LSN values assume no other record, such as the End for committed T1, is logged first; if it is, every later LSN shifts by one record. The count of 4 CLRs and the order 150, 130, 100, 70 do not change.)