CSE Roadmap

Common tier · about 2 hours · 5 parts

Part 5 of 5 · 4 min read

Exercises

Easy

Easy 1: Name the three failure types (15 minutes)

Name the three failure types covered on this page.

Done when: transaction failure, system crash, and disk failure are all correctly named.

Hint

Transaction failure, system crash, disk failure.

Easy 2: Name what survives a system crash (15 minutes)

State what survives a system crash, and what does not.

Done when: data already written to disk, including the log, surviving, while in-memory data such as the buffer pool is lost, is correctly described.

Hint

Data already written to disk, including the log, survives; data that existed only in memory, such as the buffer pool, is lost.

Easy 3: Name what recovery from disk failure requires (15 minutes)

State what recovering from a disk failure requires, since the log itself may be unreadable.

Done when: restoring from a backup on separate, undamaged storage is correctly named.

Hint

Restoring from a backup stored on separate, undamaged storage media.

Medium

Medium 1: Classify a scenario (25 minutes)

A transaction attempts to insert a row violating a CHECK constraint and is rejected, while every other transaction continues running normally. Classify this failure.

Done when: a transaction failure is correctly identified, since only one transaction is affected and the rest of the system is unaffected.

Hint

A transaction failure, since only the one violating transaction is affected while everything else continues normally.

Medium 2: Classify a second scenario (25 minutes)

A server loses power instantly, stopping every running transaction, but the disk itself is undamaged and readable once power returns. Classify this failure.

Done when: a system crash is correctly identified, since the process stopped entirely but the storage media itself remained intact.

Hint

A system crash, since the process stopped entirely but the underlying storage media itself remained undamaged and readable afterward.

Medium 3: Explain why system crash recovery can rely on the log alone (30 minutes)

Explain why recovering from a system crash can rely entirely on the write-ahead log, without needing a separate backup.

Done when: the explanation correctly notes the log itself survives a system crash intact, since only in-memory data was lost, giving recovery everything durably needed to reconstruct the correct state.

Hint

The log survives a system crash intact, since only in-memory data was lost, so recovery has everything it durably needs to reconstruct the correct state from the log alone.

Hard

Hard 1: Explain why disk failure recovery cannot rely on the log (30 minutes)

Explain specifically why a disk failure can defeat the same log-based recovery that works for a system crash.

Done when: the explanation correctly notes that if the log itself is stored on the damaged media, it may be lost or unreadable along with everything else, removing the one resource system-crash recovery depends on, which is exactly why disk failure instead requires a separately stored backup.

Hint

If the log itself is on the damaged media, it can be lost or unreadable right along with everything else, removing the exact resource system-crash recovery depends on, which is why disk failure instead needs a separately stored backup.

Hard 2: Explain why storing the log on the same disk as the data is a real risk (35 minutes)

Explain the specific risk of storing a database's write-ahead log on the exact same physical disk as its data files, in light of the distinction between a system crash and a disk failure.

Done when: the explanation correctly notes that while this arrangement works fine for system-crash recovery, since the whole disk survives a crash, it offers no protection against a disk failure, since a single damaged disk would take both the data and the one artifact needed to recover it down together.

Hint

This works fine for a system crash, since the whole disk, including the log, survives; but it provides no protection against a disk failure, since a single damaged disk would take both the data and the recovery mechanism itself down together.

Hard 3: Propose a failure-type-aware recovery strategy for a new database deployment (40 minutes)

Propose, in general terms, what a new database deployment should have in place to be able to recover correctly from each of the three failure types covered on this page.

Done when: the proposal reasonably covers automatic rollback for transaction failures (already provided by the database), a durable write-ahead log stored reliably for system-crash recovery, and a separate, regularly maintained backup on physically distinct storage for disk-failure recovery, correctly matching each mechanism to the failure type it specifically addresses.

Hint

A reasonable deployment keeps the database's own automatic rollback for transaction failures, a durably and reliably stored write-ahead log for system-crash recovery, and a separate, regularly maintained backup on physically distinct storage for disk-failure recovery, with each mechanism specifically matched to the failure type it addresses.