Recovery Based on Deferred Update
NO-UNDO / REDO Recovery Based on Deferred Update
1. Introduction
The Deferred Update recovery technique postpones all updates to the database on disk until the transaction successfully commits.
During transaction execution:
-
Changes are stored in log records and main memory buffers.
-
The actual database on disk is not updated immediately.
If the transaction fails before commit, no changes exist in the database, so no undo operation is required.
Therefore this method is called:
2. Basic Idea of Deferred Update
In this approach:
-
Transaction operations are executed normally.
-
All updates are recorded in the log file and buffer memory.
-
The database on disk is updated only after commit.
-
If a system crash occurs after commit but before updates reach disk, the updates must be redone from the log.
Thus:
| Situation | Action |
|---|---|
| Transaction fails before commit | Nothing to undo |
| System crashes after commit | Redo updates from log |
3. Logging Requirements
Only REDO-type log entries are needed.
Each log record contains:
The new value is called:
Unlike other recovery methods, before images (BFIM) are not needed because undo operations are never required.
4. Deferred Update Protocol
The protocol for deferred update consists of two main rules.
Rule 1: No Disk Update Before Commit
A transaction cannot update the database on disk until it commits.
Therefore:
-
All updated buffers must remain pinned in memory
-
These buffers cannot be replaced
This corresponds to the No-Steal policy.
Rule 2: Log Must Be Written Before Commit
A transaction can reach its commit point only after all log entries are written to disk.
This rule follows Write-Ahead Logging (WAL).
Steps:
-
Write all log records to log buffer.
-
Force-write log buffer to disk.
-
Mark transaction as committed.
5. Recovery in Deferred Update
If the system crashes, recovery is performed using log records.
Recovery procedure:
-
Identify transactions committed after the last checkpoint.
-
Redo all write operations of these transactions.
-
Ignore transactions that were active but not committed.
Because updates were never written to disk for uncommitted transactions:
-
Undo operations are unnecessary.
6. Recovery Algorithm (RDU_M)
In multiuser systems, a recovery algorithm called RDU_M (Recovery using Deferred Update in Multiuser systems) is used.
The system maintains two lists:
1. Commit List
Contains transactions that committed after the last checkpoint.
2. Active List
Contains transactions that started but did not commit before the crash.
Steps of RDU_M Recovery
-
Start scanning the log from the last checkpoint.
-
Identify committed transactions.
-
Redo all write operations of committed transactions.
-
Ignore active transactions.
Active transactions must be resubmitted for execution.
7. REDO Operation
Redo means reapplying a write operation from the log.
If the log entry is:
Then REDO performs:
Where:
-
new_value = AFIM (After Image)
8. Example Scenario
Consider a timeline of transactions.
| Time | Event |
|---|---|
| t1 | Checkpoint taken |
| After t1 | Transactions T2 and T3 commit |
| Before crash | T4 and T5 still active |
During recovery:
-
T1 → committed before checkpoint → ignore
-
T2 and T3 → committed after checkpoint → REDO
-
T4 and T5 → active → ignore (resubmit)
Thus only committed transactions after checkpoint are redone.
9. Optimization of REDO
Sometimes the same data item may be updated multiple times.
Example:
During recovery:
-
Only the last update needs to be redone.
Optimization technique:
-
Start scanning log from the end.
-
Maintain a list of items already redone.
-
Skip repeated updates.
This improves recovery efficiency.
10. Advantages of Deferred Update
1. No Undo Required
Because database updates occur only after commit.
2. No Cascading Rollback
Transactions cannot read uncommitted values because of locking.
3. Simpler Recovery
Recovery process only requires redo operations.
11. Disadvantages of Deferred Update
1. Large Buffer Requirement
Updated pages must stay in memory until commit.
2. Reduced Concurrency
Items remain write-locked until commit.
3. Not Suitable for Long Transactions
Long transactions may exhaust buffer space.
12. Relationship with Concurrency Control
Deferred update is commonly used with:
Because:
-
Write locks remain until commit.
-
Other transactions cannot read uncommitted data.
This guarantees:
-
Strict schedules
-
Serializable execution
-
No cascading rollback
13. Summary
Deferred update recovery works by postponing database updates until transaction commit.
Key characteristics:
| Feature | Description |
|---|---|
| Update time | After commit |
| Log type | REDO only |
| Undo needed | No |
| Redo needed | Yes |
| Buffer policy | No-Steal |
| Concurrency | Limited |
Thus it is called:
Deferred update recovery postpones database updates until the transaction commits. Updates are recorded only in the log and buffers during execution. If a crash occurs, only the committed transactions are redone from the log, and uncommitted transactions are ignored. Hence it is called the NO-UNDO/REDO recovery technique.


Comments
Post a Comment