The ARIES Recovery Algorithm The ARIES recovery procedure consists of 3 main steps.
- Analysis
- REDO
- UNDO
Analysis: Identifies the dirty pages in the buffer and the set of transactions active at the time of the crash. The appropriate point in the log where the REDO operation should start is also determined.
REDO: The REDO operation is applied only to committed transactions. Certain information in the ARIES log will provide the start point for REDO, from which REDO operations are applied until the end of the log is reached.
UNDO: The log is scanned backward and the operations of transactions that were active at the time of the crash are undone in reverse order.
Log sequence number (LSN): Each log record has an associated log sequence number in incremented, indicate the address of the log record on disk.
Two tables are needed for efficient recovery,
- Transaction table
- Dirty page table
Which are maintained by the transaction manager. When a crach occurs then table are build in the analysis phase of recovery.
Analysis Phase: The analysis phase begins at the checkpoint record and proceeds to the end of the log. When the end checkpoint record is encountered, the Transaction Table and Dirty Page Table are accessed. During analysis, the log records being analyzed may cause modifications to these two tables. After the checkpoint in the system log, each transaction is compared with transaction table entries, if it is not in that transaction add to the transaction table, already exist change Last_LSN to LSN in the log.
REDO phase: Find the smallest LSN, M of all the dirty pages in the dirty page table, which indicate the log position where ARIES is ready to start REDO phase. The REDO starts at the log record with LSN=M and scans forward to the end of the log. For each change recorded in the log, the REDO algorithm would verify whether or not the change has to be reapplied. Once the REDO phase is finished, the database comes to the state prior to the failure.
UNDO phase: The set of active transactions called the undo set identified in the transaction table during the analysis phase. Now undo phase proceeds by scanning backward from the end of the log and undoing the appropriate actions. When this is completed, the recovery process is finished.
