Professional Documents
Culture Documents
Recovery Updated
Recovery Updated
Goal
Goal of this lecture is to study Crash Recovery
which is subpart of transaction management
in DBMS. Crash recovery in DBMS is achieved
through maintaining logs and checkpoints.
Outline of Presentation
1.Review of ACID Properties
1.1 Motivation
1.2 Assumptions
1.3 Handling Buffer Pool
2. Basic Idea :Logging
2.1 Write-Ahead Logging
2.2 WAL & the Log
2.3 Log Records
2.4 Other log-related state
2.5 Normal execution of transactions
3. Checkpoints
3.1 Big picture of storage
3.2 Simple Transactions Abort
3.2 Abort Cont.
3.3 Transaction Commit
3.4 Crash recovery
3.5 Recovery: The analysis phase
3.6 Recovery: The REDO phase
3.7 Recovery: Undo phase
4. Summary
Durability.
1.1
Motivation
Atomicity:
Transactions may abort (Rollback).
Durability:
What if DBMS stops running? (Causes?)
T1
T2
T3
T4
T5
crash!
1.2 Assumptions
Concurrency control is in effect.
Strict 2PL, in particular.
Updates are happening in place.
i.e. data is overwritten on (deleted from) the
disk.
Durability?
No Steal
Force
Steal
Trivial
No Force
atomicity?
Desired
written to disk?
Write as little as possible, in a convenient place,
at commit time,to support REDOing
modifications.
update, in a log.
Sequential writes to log (put it on a separate
disk).
Minimal infowritten to log, so multiple updates fit
in a single log page.
#1 guarantees Atomicity.
#2 guarantees Durability.
Exactly how is logging (and recovery!) done?
Well study the ARIES algorithms.
DB
LSNs
RAM
pageLSNs
flushedLSN
Number (LSN).
Log records
flushed to disk
Log tail
in RAM
or abort.
We will assume that write is atomic on disk.
Strict 2PL.
STEAL, NO-FORCE buffer management, with
Write-Ahead Logging.
DB
LogRecords
prevLSN
XID
type
pageID
length
offset
before-image
after-image
Data pages
each
with a
pageLSN
master record
RAM
Xact Table
lastLSN
status
flushedLSN
flushed.
Guarantees that flushedLSN lastLSN.
Note that log flushes are sequential,
Commit() returns.
Write end record to log.
Oldest log
rec. of Xact
active at
crash
Smallest
recLSN in
dirty page
table after
Analysis
Last chkpt
CRASH
A R U
action unless:
Affected page is not in the Dirty Page Table (D.P.T.).
To REDO an action:
Reapply logged action.
Set pageLSN to LSN. No additional logging!
4.0 Summary of
Logging/Recovery
Recovery Manager guarantees Atomicity &
Durability.
Use WAL to allow STEAL/NO-FORCE w/o
sacrificing correctness.
LSNs identify log records; linked into
backwards chains per transaction.
pageLSN allows comparison of data page and
log records.
rver.102/b14220/transact.htm
http://queens.db.toronto.edu/~koudas/courses/csc
d43/Lecture9.pdf
Review Questions
What does ACID stands for ?
Explain why we need logs for transaction
management.
Name some log record types.
Why does DBMS create checkpoints?
Illustrate crash recovery ?
Thank
You !
References:
Database Management System 3rd Edition by R. Ramakrishnan and J. Gehrke