Algorithm Search⌘K

Logging and recovery

Problems

  • Crash recovery problem

    After a crash that loses main memory but keeps the disk, bring the database to the state that holds the effects of exactly the committed transactions.

    core
  • Media recovery

    Restore a database after the loss of stable storage from an archive copy and the log written since that copy was taken.

    core

Algorithms

  • Fuzzy checkpoint

    A checkpoint that records the dirty pages and active transactions without stopping new updates or forcing pages to disk.

    O(n + m + d) worst1 languagescore
  • Undo/redo logging

    Log before and after images of each update so that recovery redoes committed work and undoes uncommitted work under any buffer policy.

    O(n) worst1 languagescore
  • ARIES recovery

    Write-ahead-log recovery in three passes: analysis rebuilds the transaction and dirty page tables, redo repeats history, undo rolls back losers and logs compensation records.

    O(n + u log m) worst1 languagesadvanced
  • Multi-level transaction recovery

    Recover transactions whose operations release low-level locks early by undoing completed subtransactions with logical inverse operations.

    O(n + u (c + log m) + c m) worst1 languagesadvanced
  • Instant restart

    Admit new transactions right after log analysis and redo or undo each page or transaction on demand when it is first touched.

    O(n + u + m) worst1 languagesresearch

Data structures

  • Differential file

    Keep changes in a separate file with a filter of changed keys and merge them into the main file later, which eases backup and recovery.

    Θ(k) worst1 languagesadvanced

Techniques

  • Checkpointing

    Write a marker and recovery tables to the log, and name it in a master record, so that restart after a crash reads only a bounded tail of the log.

    1 languagescore
  • Logical logging

    Log the high-level operation, such as insert this key, instead of the bytes changed, so undo can work on a page that has since changed.

    core
  • Point-in-time recovery

    Restore a backup and replay the archived log up to a chosen time, which undoes the effect of a later user error.

    1 languagescore
  • Shadow paging

    Recovery without an undo or redo log for page contents: a transaction writes changed pages to new places, and commits by an atomic switch of the root page table pointer.

    1 languagescore
  • Write-ahead logging

    Log each change to stable storage before the page it changes (the WAL rule), and log all of a transaction before its commit returns (the commit rule). Recovery then redoes and undoes.

    1 languagescore
  • Command logging

    Log only the transaction requests of a deterministic in-memory database and recover by replaying them from a checkpoint.

    1 languagesadvanced
  • Group commit

    Make one log write durable for the commit records of many transactions, so the commit rate is no longer bounded by one log device write per transaction.

    1 languagesadvanced
  • Write-behind logging

    A protocol for non-volatile memory that writes data first and logs only commit timestamp ranges, so recovery needs no redo.

    1 languagesresearch

Concepts

  • Physiological logging

    Log records that name a page physically but describe the change inside the page logically, which keeps records small and redo per page.

    core
  • Steal and force buffer policies

    Two buffer manager choices: may a page with uncommitted changes go to disk (steal), and must commit write all changed pages (force). Steal needs undo; no-force needs redo.

    core

Definitions

  • Compensation log record

    A redo-only log record written when an update is undone, which points to the next record to undo so rollback is never repeated.

    core
  • Log sequence number

    A monotone address of a log record; each page stores the LSN of its last update so recovery knows which updates it already holds.

    core
  • Savepoint

    A named point inside a transaction to which it can roll back, undoing later updates while keeping the earlier ones.

    core