- Year not given
Recovery from log: deferred vs immediate
Short answer
Under deferred modification, redo T0 (A=950, B=2050) and no action for T1. Under immediate modification, redo T0 (A=950, B=2050) and undo T1 (restore C to 700).
Consider the following log at the time of a crash. Deferred modification: <T0 start>, <T0, A, 950>, <T0, B, 2050>, <T0 commit>, <T1 start>, <T1, C, 600> Immediate modification: <T0 start>, <T0, A, 1000, 950>, <T0, B, 2000, 2050>, <T0 commit>, <T1 start>, <T1, C, 700, 600> State the recovery actions (redo/undo) required for each transaction under both schemes.
After a crash the system scans the log. A transaction with both <T start> and <T commit> is redone; a transaction with <T start> but no <T commit> is incomplete.
Deferred modification
In deferred modification, writes to the database are postponed until the transaction commits. The log record <T, X, new> holds only the new value.
Log: <T0 start>, <T0, A, 950>, <T0, B, 2050>, <T0 commit>, <T1 start>, <T1, C, 600>
| Transaction | Log status | Action |
|---|---|---|
| T0 | start and commit | redo(T0): set A = 950, B = 2050 |
| T1 | start, no commit | nothing (no undo needed) |
T1 had not committed, so none of its writes had reached the database; its log records are simply ignored and C keeps its old value. No undo is needed in deferred modification. Redo is idempotent, so repeating it is safe.
Immediate modification
In immediate modification, updates may reach the database before commit. The log record <T, X, old, new> holds both values.
Log: <T0 start>, <T0, A, 1000, 950>, <T0, B, 2000, 2050>, <T0 commit>, <T1 start>, <T1, C, 700, 600>
| Transaction | Log status | Action |
|---|---|---|
| T0 | start and commit | redo(T0): set A = 950, B = 2050 (new values) |
| T1 | start, no commit | undo(T1): set C = 700 (old value); write <T1 abort> |
Order of recovery: in the classic scheme the undo pass scans the log backward and restores the old values of incomplete transactions (C = 700), and then the redo pass scans forward and reapplies the committed ones (A = 950, B = 2050). The newer "repeating history" algorithm does the redo pass first and then the undo pass. Here T0 and T1 touch different items, so both orders give the same result.
Final state after recovery
- A = 950, B = 2050 (T0 committed)
- C = 700 (T1's change removed)
| Scheme | Redo | Undo |
|---|---|---|
| Deferred | T0 | none |
| Immediate | T0 | T1 |
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- RA: delete loans under 1000 · Database Management System, chapter 3
- Transaction recovery techniques · Distributed System, chapter 8
- Rock layer attitude: A 700 m N, C 600 m W · Engineering Geology II, chapter 6 · asked 2×
- SC filter: 6 dB between 1000 and 2000 rad/s · Filter Design, chapter 9
- TCTO numerical: optimal crashed time, Rs 3000/week · Construction Management, chapter 2 · asked 2×