Open In App

Algorithm for Recovery and Isolation Exploiting Semantics (ARIES)

Last Updated : 13 Aug, 2025
Comments
Improve
Suggest changes
19 Likes
Like
Report

ARIES is a robust recovery algorithm based on the Write-Ahead Logging (WAL) protocol, widely used in modern DBMS to ensure durability and consistency after system failures.

Types of Log Records in ARIES

Every update operation creates a log record, which can be of the following types:

  • Undo-only Log Record: Stores only the before image (original data). Used to undo changes.
  • Redo-only Log Record: Stores only the after image (new data). Used to redo changes.
  • Undo-Redo Log Record: Stores both before and after images. Used for both undo and redo operations.

Log Sequence Numbers (LSN)

  • Every log record is assigned a unique, monotonically increasing LSN.
  • Every data page has a pageLSN indicating the LSN of the last update applied to it.

Write-Ahead Logging (WAL) Rules

  • A log record must reach stable storage before the corresponding data page is written to disk.
  • Log writes are buffered in a memory area called the log tail.
  • The log tail is flushed to disk when full.
  • A transaction is not considered committed until its commit record is flushed to disk.

Checkpoints

Periodically, the system writes a checkpoint record to the log.

A checkpoint contains:

  • Transaction Table
  • Dirty Page Table

A master log record, stored in stable storage, holds the LSN of the most recent checkpoint.

Recovery Phases in ARIES

When the system restarts after a crash, ARIES performs three recovery phases:

1. Analysis Phase

  • Starts from the latest checkpoint.
  • Reconstructs the state of active transactions and dirty pages at the time of the crash.

2. Redo Phase

  • Replays operations forward from the smallest LSN of dirty pages.
  • Reapplies necessary changes to bring the database to the state before crash.

3. Undo Phase

  • Scans the log backward.
  • Rolls back the effects of uncommitted (loser) transactions.

Explore