CMSC 724: Recovery: Amol Deshpande
CMSC 724: Recovery: Amol Deshpande
CMSC 724: Recovery: Amol Deshpande
Amol Deshpande
University of Maryland, College Park
March 6, 2007
Recovery
Recovery
STEAL:
The buffer manager can steal a memory page for replacement purposes The page might contain dirty writes
FORCE:
Before committing a transaction, force its updates to disk
Recovery
Desired option: STEAL, NO FORCE STEAL:
Dirty data might be written on disk Need to use UNDO logs so we can rollback that action The UNDO log records must be on disk before the page can be written (Write-Ahead Logging)
NO FORCE:
Data from committed transaction might not make it to disk Use REDO logs The REDO log records must make it disk before the transaction is committed
ARIES
Log-based Recovery
Every database action is logged Even actions performed during undo (also called rollback) are logged
Log records:
(LSN, Type, TransID, PrevLSN, PageID, UndoNextLSN (CLR Only), Data) LSN = Log Sequence Number Type = Update | Compensation Log Record | Commit related | Non-transaction related (OS stuff) Allows logical logging
More compact, Allows higher concurrency (indexes)
ARIES: Logs
Physical Undos or Redos (also called page-oriented)
Store before and after copies Easier to manage, apply - no need to touch any other pages Requires stricter locking behaviour
Logical Undos
More compact, allow higher concurrency May not be idempotent: Shouldnt undo twice
CLRs
Redo-only; Typically generated during abort/rollback Contain an UndoNextLSN - can skip already undone records.
ARIES: Assumptions/Setup
STEAL, NO FORCE In-place updating Write-ahead Logging (WAL)
Log records go to the stable storage before the corresponding page (at least UNDO log records) May have to ush log records to disk when writing a page to disk
Latches vs Locks
Latches used for physical consistency Latches shorter duration
ARIES: Advanced
Selective and deferred restart Fuzzy image copies Media recovery High concurrency lock modes (for increment/decrement operations) Nested Top Actions:
Transactions within transactions E.g. Split a B+-Tree page; Increase the Extent size etc. . . Use a dummy CLR to skip undoing these if the enclosing transaction is undone.