Learning objectives
What you will be able to explain
- Which type of failure occurs when a head crash or similar disk failure destroys parts of the non-volatile storage?
- Regarding failure assumptions and types:
- The property that ensures no partial changes of an aborted transaction are permanent is [Atomicity / Durability / Consistency].
- Which component of the DBMS architecture is responsible for ensuring the database remains in a consistent state despite failures?
- The "Steal" policy refers to:
- Which policy enforces Durability by requiring all updates of a transaction to be on disk before it can commit?
Section 01
Which type of failure occurs when a head crash or similar disk failure destroys parts of the non-volatile storage? to The property that ensures no partial changes of an aborted transaction are permanent is [Atomicity / Durability / Consistency].
01
Which type of failure occurs when a head crash or similar disk failure destroys parts of the non-volatile storage?
This is a media failure because physical non-volatile storage itself is damaged. Recovery requires restoring data from backups plus logs, unlike ordinary crash recovery.
02
Regarding failure assumptions and types:
A is True because deadlocks are internal runtime failures causing transaction aborts. B is False because standard system-crash assumptions keep disk contents intact. C is True since media failures destroy persisted data and require backup-based restore.
03
The property that ensures no partial changes of an aborted transaction are permanent is [Atomicity / Durability / Consistency].
Atomicity guarantees all-or-nothing effects: if a transaction aborts, none of its partial writes may remain visible as permanent state.
Section 02
Which component of the DBMS architecture is responsible for ensuring the database remains in a consistent state despite failures? to Which policy enforces Durability by requiring all updates of a transaction to be on disk before it can commit?
01
Which component of the DBMS architecture is responsible for ensuring the database remains in a consistent state despite failures?
The recovery manager enforces crash-consistency via logging, undo/redo, checkpoint handling, and restart recovery procedures.
02
The "Steal" policy refers to:
Steal means the buffer manager may evict dirty pages even when their transactions are uncommitted, which improves memory flexibility but requires UNDO capability.
03
Which policy enforces Durability by requiring all updates of a transaction to be on disk before it can commit?
Force policy writes all updated pages to disk before commit returns, directly enforcing durability at commit time.
Section 03
Select all correct statements regarding the "No-Force" policy: to If a DBMS uses a [Steal / No-Steal] policy, it MUST be able to perform an UNDO operation during recovery.
01
Select all correct statements regarding the "No-Force" policy:
No-Force avoids forcing dirty pages at commit, so commits are faster (A) but REDO may be needed after crashes (B). Modern engines commonly use Steal + No-Force for performance (D).
02
Which combination of policies is characterized as the "Slowest" and "Trivial" because it requires no Undo and no Redo?
No-Steal + Force is conceptually simplest for recovery (needing neither undo nor redo), but it is slow because it restricts buffer flushing and forces commit-time page writes.
03
If a DBMS uses a [Steal / No-Steal] policy, it MUST be able to perform an UNDO operation during recovery.
If Steal is allowed, uncommitted updates can reach disk, so recovery must be able to UNDO loser transaction effects.
Section 04
About Shadow Paging: to What are known disadvantages of Shadow Paging?
01
About Shadow Paging:
Answers: A: False (It uses Force + No-Steal), B: True, C: True
02
In Shadow Paging, when a transaction commits, how does the DBMS make the changes permanent?
Shadow paging commits by atomically switching the root/master pointer to the newly built page table, making new versions instantly authoritative.
03
What are known disadvantages of Shadow Paging?
Shadow paging can fragment data placement (A), needs garbage collection of obsolete pages (C), and interacts poorly with high concurrency/complex transaction workloads (D).
Section 05
What is the fundamental rule of WAL regarding data page flushes? to Why is Sequential Logging (WAL) generally faster than Shadow Paging during normal operation?
01
What is the fundamental rule of WAL regarding data page flushes?
WAL requires log-before-data: the update log record must be durably flushed before the corresponding data page can be written to disk.
02
In WAL, the condition [pageLSN <= flushedLSN / pageLSN > flushedLSN] must be met before a page is written to disk.
A page may be flushed only when every update reflected on that page is already durable in the log, i.e., `pageLSN <= flushedLSN`.
03
Why is Sequential Logging (WAL) generally faster than Shadow Paging during normal operation?
WAL appends compact log records sequentially, which is much faster than random page rewrites typical of shadow-style page relocation.
Section 06
What information is typically contained in an "Update" log record? to [Logical / Physical / Physiological] logging is the most flexible and is used by the ARIES recovery algorithm.
01
What information is typically contained in an "Update" log record?
Update records in ARIES-style WAL include transaction identity, page identity, before/after information (or equivalent redo/undo data), and linkage (`prevLSN`) for transaction-chain traversal.
02
Which logging scheme records byte-level changes to specific offsets in a page?
Physical logging records concrete byte/offset page modifications, making it page-structure specific and straightforward for low-level redo/undo.
03
[Logical / Physical / Physiological] logging is the most flexible and is used by the ARIES recovery algorithm.
ARIES uses physiological logging: records are tied to a page (physical scope) while describing logical action within that page, balancing flexibility and efficiency.
Section 07
What is the main purpose of "Checkpointing"? to In which phase of ARIES recovery does the DBMS identify "Winner" and "Loser" transactions?
01
What is the main purpose of "Checkpointing"?
Checkpointing bounds recovery work by recording a restart point plus metadata, so crash recovery reads less log history and starts from a fresher state.
02
Which are common criteria for performing a checkpoint?
Common checkpoint triggers include elapsed time, log growth thresholds, and controlled shutdown events. Triggering on every single DML operation is usually too expensive.
03
In which phase of ARIES recovery does the DBMS identify "Winner" and "Loser" transactions?
ARIES Analysis scans from the last checkpoint to reconstruct transaction/table-of-dirty-pages state and classify winners/losers at crash time.
Section 08
What does the "Redo" phase do? to During the Redo phase, if a log record's LSN is 100 and the page's pageLSN is 105, the DBMS [Should / Should Not] apply the update to the page.
01
What does the "Redo" phase do?
Redo in ARIES repeats history forward, reapplying actions as needed (subject to LSN checks) so the database reaches the exact pre-crash state before logical cleanup.
02
About the Undo Phase:
A is True because undo traverses loser histories backward. B is False since winners are not undone. C is True because CLRs make undo idempotent and restart-safe.
03
During the Redo phase, if a log record's LSN is 100 and the page's pageLSN is 105, the DBMS [Should / Should Not] apply the update to the page.
Do not redo. If pageLSN is already 105, a log record with LSN 100 is older than the page state, so reapplying it would be redundant or incorrect.
Section 09
A "Winner" transaction is one that: to During Redo, the DBMS encounters a log record: LSN 200, update Page P5 (Old: 10, New: 20). The DBMS fetches Page P5 from disk, and its `pageLSN` is 150. Should the Redo operation be performed? Explain the logic.
01
A "Winner" transaction is one that:
A winner is a transaction that has committed before crash; committed work must survive recovery and therefore belongs to the winner set.
02
Identify the Winners and Losers at crash time.
Path of Calculation:
1. Start Analysis: T1 and T2 are active.
2. LSN 50 shows <T1 COMMIT>. T1 becomes a Winner.
3. End of log reached. T2 has no COMMIT/ABORT. T2 is a Loser.
Result: Winners: {T1}, Losers: {T2}.
Guided checkpoint
A system uses WAL with Steal and No-Force. At crash time, the log contains:
| LSN | Log Record |
|---|---|
| 10 | |
| 20 | |
| 30 | |
| 40 | |
| 50 |
Identify the Winners and Losers.
03
During Redo, the DBMS encounters a log record: LSN 200, update Page P5 (Old: 10, New: 20). The DBMS fetches Page P5 from disk, and its `pageLSN` is 150. Should the Redo operation be performed? Explain the logic.
Path:
1. Redo rule: Apply update if `pageLSN` < `logLSN`.
2. Here, 150 < 200.
Result: Yes, the update should be performed because the version on disk (150) is older than the log entry (200).
Section 10
A system crashes. Analysis identifies T5 as a Loser. T5's log records are: - LSN 10: <T5, P1, val:100> - LSN 25: <T5, P2, val:200> - LSN 40: <T5, P1, val:150> In what order are these operations undone during the Undo phase? to A system crashes and begins recovery. - LSN 100: <T1 BEGIN> - LSN 110: <T1, P1, 10, 20> - LSN 120: <T2 BEGIN> - LSN 130: <T2, P2, 50, 60> - LSN 140: <T1 COMMIT> Initial values on disk: P1=10, P2=50. What are the values of P1 and P2 after the Redo phase, and what are they after the Undo phase?
01
A system crashes. Analysis identifies T5 as a Loser. T5's log records are: - LSN 10: <T5, P1, val:100> - LSN 25: <T5, P2, val:200> - LSN 40: <T5, P1, val:150> In what order are these operations undone during the Undo phase?
Path:
1. Undo phase reads the log backward.
2. The last operation for T5 is LSN 40.
Result: LSN 40 first, then LSN 25, then LSN 10.
02
In a WAL system, Transaction T3 updates Page P9. The update is assigned LSN 500. The current `flushedLSN` on stable storage is 450. The Buffer Manager needs to evict Page P9 from memory to make room. What MUST happen before Page P9 can be written to disk?
Path:
1. WAL rule: `pageLSN` <= `flushedLSN`.
2. Page P9's `pageLSN` is 500. Stable `flushedLSN` is 450.
3. 500 > 450, so the rule is violated.
Result: The DBMS must flush the log records up to at least LSN 500 to the stable log before writing Page P9 to disk.
03
A system crashes and begins recovery. - LSN 100: <T1 BEGIN> - LSN 110: <T1, P1, 10, 20> - LSN 120: <T2 BEGIN> - LSN 130: <T2, P2, 50, 60> - LSN 140: <T1 COMMIT> Initial values on disk: P1=10, P2=50. What are the values of P1 and P2 after the Redo phase, and what are they after the Undo phase?
Path:
1. Analysis: T1 is Winner, T2 is Loser.
2. Redo: Repeat all history. P1 becomes 20, P2 becomes 60.
3. Undo: Undo Losers. T2 is a loser. Revert P2 from 60 back to 50.
Result: After Redo: P1=20, P2=60. After Undo: P1=20, P2=50.
Section 11
If a log record is 128 bytes and a data page is 4 KB (4096 bytes), how many log records can fit into the storage space of a single data page?
01
If a log record is 128 bytes and a data page is 4 KB (4096 bytes), how many log records can fit into the storage space of a single data page?
Path:
1. 4096 bytes / 128 bytes = 32.
Result: 32 log records. (Context: Log records are much smaller than data pages, allowing many to be flushed in one sequential I/O).
Knowledge check
Turn understanding into recall.
The quiz now follows the same concepts in scored form. You can return to this lesson from the quiz whenever a gap appears.