CH 5 Recovery
CH 5 Recovery
TECHNIQUES
Recovery algorithms
Recovery concepts
Write-ahead logging
Rollback
Deferred update
Immediate update
Slide 22- 2
22.1 Recovery Concepts
Slide 22- 3
Recovery Concepts (cont’d.)
Slide 22- 4
Recovery Concepts (cont’d.)
Slide 22- 5
Recovery Concepts (cont’d.)
Slide 22- 6
Recovery Concepts (cont’d.)
Main strategies
In-place updating
Writes the buffer to the same original disk location
Overwrites old values of any changed data items
Shadowing
Writes an updated buffer at a different disk location, to maintain
multiple versions of data items
Not typically used in practice
Slide 22- 7
Recovery Concepts (cont’d.)
Write-ahead logging
Ensure the before-image (BFIM) is recorded
Slide 22- 8
Recovery Concepts (cont’d.)
Slide 22- 9
Recovery Concepts (cont’d.)
Force approach
All pages updated by a transaction are immediately written to
disk before the transaction commits
Otherwise, no-force
Slide 22- 10
Recovery Concepts (cont’d.)
Slide 22- 11
Checkpoints in the System Log and Fuzzy
Checkpointing
Taking a checkpoint
Suspend execution of all transactions temporarily
Slide 22- 12
Checkpoints in the System Log and Fuzzy
Checkpointing (cont’d.)
Fuzzy checkpointing
System can resume transaction processing after a
begin_checkpoint record is written to the log
Previous checkpoint record maintained until end_checkpoint
record is written
Slide 22- 13
Transaction Rollback
Cascading rollback
If transaction T is rolled back, any transaction S that has read
value of item written by T must also be rolled back
Almost all recovery mechanisms designed to avoid this
Slide 22- 14
Figure 22.1 Illustrating
cascading rollback (a
process that never occurs
in strict or cascadeless
schedules) (a) The read
and write operations of
three transactions (b)
System log at point of
crash (c) Operations
before the crash
Slide 22- 15
Transactions that Do Not Affect the Database
Slide 22- 16
22.2 NO-UNDO/REDO Recovery Based on
Deferred Update
Deferred update concept
Postpone updates to the database on disk until the transaction
completes successfully and reaches its commit point
Redo-type log entries are needed
Slide 22- 17
NO-UNDO/REDO Recovery Based on
Deferred Update (cont’d.)
Deferred update protocol
Transaction cannot change the database on disk until it
reaches its commit point
All buffers changed by the transaction must be pinned until the
transaction commits (no-steal policy)
Transaction does not reach its commit point until all its
REDO-type log entries are recorded in log and log buffer is
force-written to disk
Slide 22- 18
NO-UNDO/REDO Recovery Based on Deferred
Update (cont’d.)
Slide 22-19
22.3 Recovery Techniques Based
on Immediate Update
Slide 22- 20
Figure 22.3 An example
of recovery using
deferred update with
concurrent transactions
(a) The READ and
WRITE operations of
four transactions (b)
System log at the point
of crash
Slide 22- 21
22.4 Shadow Paging
Slide 22- 22
Shadow Paging (cont’d.)
NO-UNDO/NO-REDO technique
Slide 22- 23
Shadow Paging (cont’d.)
Slide 22- 24
22.5 The ARIES Recovery Algorithm
Slide 22- 25
The ARIES Recovery Algorithm (cont’d.)
Analysis step
Identifies dirty (updated) pages in the buffer and set of
transactions active at the time of crash
Determines appropriate start point in the log for the REDO
operation
REDO
Reapplies updates from the log to the database
Slide 22- 26
The ARIES Recovery Algorithm (cont’d.)
UNDO
Log is scanned backward
Slide 22- 27
ARIES Recovery Example
Figure 22.5 An
example of recovery
in ARIES (a) The log
at point of crash (b)
The Transaction and
Dirty Page Tables at
time of checkpoint
(c) The Transaction
and Dirty Page
Tables after the
analysis phase
Slide 16-28
22.6 Recovery in Multidatabase Systems
Slide 22- 29
Recovery in Multidatabase Systems (cont’d.)
Slide 22- 30
22.7 Database Backup and Recovery
from Catastrophic Failures
Database backup
Entire database and log periodically copied onto inexpensive
storage medium
Latest backup copy can be reloaded from disk in case of
catastrophic failure
Backups often moved to physically separate locations
Subterranean storage vaults
Slide 22- 31
Database Backup and Recovery
from Catastrophic Failures (cont’d.)
Slide 22- 32
22.8 Summary
Caching
In-place updating versus shadowing
Before and after images of data items
UNDO and REDO operations
Deferred versus immediate update
Shadow paging
Catastrophic failure recovery
Slide 22- 33