Database Systems · Recovery Policies: Steal-Force, Deferred and Immediate Update, Shadow Paging and ARIES
The two buffer-management decisions
This chapter assumes you already know what a transaction is, what a log record looks like, and why we need atomicity and durability (see Transactions and ACID and Recoverability). Here we go one level deeper: which pages may be written to disk when, what the log must contain before a page is written, and how the recovery manager rebuilds a consistent state after a crash. These are the exact questions GATE, UGC NET, ISRO and BARC ask.
A database keeps pages in a buffer pool in main memory. When a transaction modifies a page, the page becomes dirty (modified in memory, not yet on disk). Two independent policy questions decide what the buffer manager is allowed to do:
- Steal vs No-Steal — may a dirty page belonging to an uncommitted transaction be written to disk (i.e. may its buffer frame be "stolen" for another page)?
- Steal: yes, an uncommitted transaction's dirty page may be flushed.
- No-Steal: no, a dirty page of an uncommitted transaction is pinned until that transaction commits.
- Force vs No-Force — at commit, must all pages modified by the transaction be forced (flushed) to disk before the commit is acknowledged?
- Force: yes, flush at commit.
- No-Force: no, the commit is acknowledged once the log record is on disk; data pages may be flushed later.
These two choices are independent, giving a table. The key insight: Steal creates the need for UNDO; No-Force creates the need for REDO.
1.1 The 2×2 table
| Policy | Steal? | Force? | UNDO needed? | REDO needed? | Why |
|---|---|---|---|---|---|
| Steal + No-Force | yes | no | Yes | Yes | Uncommitted changes may be on disk (must undo); committed changes may not be on disk (must redo). |
| Steal + Force | yes | yes | Yes | No | Uncommitted changes may be on disk (undo); every committed change is guaranteed on disk (no redo). |
| No-Steal + No-Force | no | no | No | Yes | Uncommitted changes never reach disk (no undo); committed changes may not be on disk (redo). |
| No-Steal + Force | no | yes | No | No | Nothing uncommitted on disk, everything committed on disk. |
Reasoning to memorise (one line each):
- Steal ⇒ UNDO. If a dirty page of an uncommitted transaction reached disk and the transaction later aborts (or the system crashes), those changes are on disk and must be rolled back.
- No-Force ⇒ REDO. If a committed transaction's pages were not flushed at commit, a crash loses them; they must be re-applied from the log.
Which combination do real systems use? Almost all real systems (and ARIES) use Steal + No-Force, because it gives the best performance: the buffer manager is free to evict any page, and commit does not stall on I/O. That is why real recovery needs both UNDO and REDO.
GATE convention. When a question says "the system uses steal and no-force", it means both undo and redo are required. When it says "no-steal, force", it means neither is required. Read the policy words carefully — they are the whole question.