The three phases of ARIES recovery
crash-recovery internals.
Analysis rebuilds dirty-page and transaction tables from the last checkpoint, Redo replays all logged changes to restore state, Undo rolls back losers; Redo is idempotent via per-page LSN comparison so…
WHAT THIS TESTS The interviewer probes deep recovery knowledge: the three phases, the repeating-history principle, and why and how Redo stays idempotent.
A GOOD ANSWER COVERS ARIES recovers in three forward-and-backward phases. Analysis scans the log forward from the most recent checkpoint to reconstruct the active transaction table, identifying which transactions were in flight, and the dirty page table, identifying which pages may have unflushed changes, and it computes the redo start point as the oldest such change. Redo then repeats history: it scans forward and reapplies every logged update, including those of transactions that later aborted, bringing all pages to their exact state at the moment of the crash. Undo finally scans backward and rolls back the transactions that were uncommitted at crash time, the losers, writing compensation log records so this rollback is itself logged and restartable. Redo must be idempotent because the recovery process can crash and be rerun, and you must never double-apply a change. This is achieved by stamping every page with the LSN of the last change applied to it; during Redo the engine compares a log record's LSN to the page's stored LSN and skips the record if the page already reflects it, applying only changes the page has not yet seen.
COMMON WRONG ANSWERS Saying Redo replays only committed transactions; ARIES repeats history for all, then Undo removes losers. Reversing the phase order. Claiming idempotency comes from locking rather than LSN comparison. Forgetting compensation records make Undo restartable.
LIKELY FOLLOW-UPS What is repeating history and why; what is a compensation log record; why stamp pages with LSNs; what happens if recovery crashes mid-Redo.
ONE CONCRETE EXAMPLE A page on disk carries page-LSN 500. During Redo the engine encounters log records at LSN 480 and 520. It skips 480 because the page already reflects it, since 480 is below 500, and applies 520, updating the page-LSN to 520. If recovery crashes and reruns, it again skips everything at or below 520, so no change is applied twice.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.