MATRUSRI ENGINEERING COLLEGE�DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
SUBJECT NAME: DataBase Management Systems
FACULTY NAME: K Sunil Manohar Reddy
Insert Your Photo here🡪
MATRUSRI
ENGINEERING COLLEGE
INTRODUCTION: ��THIS UNIT DEALS WITH THE CONCURRENCY CONTROL AND RECOVERY SYSTEM
UNIT-V
OUTCOMES:
Upon completion of this unit, student will be able to:
MATRUSRI
ENGINEERING COLLEGE
CONTENTS:� RECOVERY SYSTEM: FAILURE CLASSIFICATION, STORAGE STRUCTURE, RECOVERY AND ATOMICITY, LOG-BASED RECOVERY, RECOVERY WITH CONCURRENT TRANSACTIONS, BUFFER MANAGEMENT, FAILURE WITH LOSS OF NON-VOLATILE STORAGE, ADVANCED RECOVERY TECHNIQUES, REMOTE BACKUP SYSTEMS ��
OUTCOMES:
Upon completion of this module, student will be able to:
MODULE-II
MATRUSRI
ENGINEERING COLLEGE
Failure Classification
MATRUSRI
ENGINEERING COLLEGE
Storage Structure
Volatile storage:
Does not survive system crashes
Examples: main memory, cache memory
Nonvolatile storage:
Survives system crashes
Examples: disk, tape, flash memory, non-volatile RAM
But may still fail, losing data
Stable storage:
A mythical form of storage that survives all failures
Approximated by maintaining multiple copies on distinct nonvolatile media
See book for more details on how to implement stable storage
MATRUSRI
ENGINEERING COLLEGE
Stable-Storage Implementation
MATRUSRI
ENGINEERING COLLEGE
Protecting storage media from failure (Cont.)
1. First find inconsistent blocks:
Record in-progress disk writes on non-volatile storage (Flash, Non-volatile RAM or special area of disk).
Use this information during recovery to find blocks that may be inconsistent, and only compare copies of these.
Used in hardware RAID systems
2. If either copy of an inconsistent block is detected to have an error
(bad checksum), overwrite it by the other copy. If both have no error,
but are different, overwrite the second block by the first block.
MATRUSRI
ENGINEERING COLLEGE
Recovery and Atomicity
To ensure atomicity despite failures, we first output information describing the modifications to stable storage without modifying the database itself.
We study log-based recovery mechanisms in detail
We first present key concepts
And then present the actual recovery algorithm
Less used alternative: shadow-copy and shadow-paging (brief details in book)
MATRUSRI
ENGINEERING COLLEGE
shadow-copy
Log-Based Recovery
� <Ti start> log record
� <Ti, X, V1, V2> �
is written, where V1 is the value of X before the write (the old
value), and V2 is the value to be written to X (the new value).
Immediate database modification
Deferred database modification.
MATRUSRI
ENGINEERING COLLEGE
Concurrency Control and Recovery
MATRUSRI
ENGINEERING COLLEGE
Undo and Redo Operations
MATRUSRI
ENGINEERING COLLEGE
Recovering from Failure
MATRUSRI
ENGINEERING COLLEGE
Advanced recovery techniques
Checkpoints
1. Output all log records currently residing in main memory onto stable
storage.
3. Write a log record < checkpoint L> onto stable storage where L is a
list of all transactions active at the time of checkpoint.
4. All updates are stopped while doing checkpointing
MATRUSRI
ENGINEERING COLLEGE
Checkpoints (Cont.)
MATRUSRI
ENGINEERING COLLEGE
Fuzzy Checkpointing
1. Temporarily stop all updates by transactions
2. Write a <checkpoint L> log record and force log to stable storage
3. Note list M of modified buffer blocks
4. Now permit transactions to proceed with their actions
5. Output to disk all modified buffer blocks in list M
blocks should not be updated while being output
Follow WAL: all log records pertaining to a block must be output before the block is output
6. Store a pointer to the checkpoint record in a fixed position
last_checkpoint on disk
MATRUSRI
ENGINEERING COLLEGE
Database Buffering
MATRUSRI
ENGINEERING COLLEGE
Database Buffering (Cont.)
Such locks held for short duration are called latches.
1. First acquire an exclusive latch on the block
2. Then perform a log flush
3. Then output the block to disk
4. Finally release the latch on the block
MATRUSRI
ENGINEERING COLLEGE
Buffer Management
Known as dual paging problem.
Dual paging can thus be avoided, but common operating systems do not support such functionality.
MATRUSRI
ENGINEERING COLLEGE
Failure with Loss of Nonvolatile Storage
MATRUSRI
ENGINEERING COLLEGE
Recovering from Failure of Non-Volatile Storage
MATRUSRI
ENGINEERING COLLEGE
Remote Backup Systems
MATRUSRI
ENGINEERING COLLEGE
Remote Backup Systems (Cont.)
MATRUSRI
ENGINEERING COLLEGE
Remote Backup Systems (Cont.)
MATRUSRI
ENGINEERING COLLEGE
Remote Backup Systems (Cont.)
MATRUSRI
ENGINEERING COLLEGE