Open lesson

Mission: the forgotten log copy

Command palette

This mission workspace keeps code and notes in this browser tab. Export them before closing it. Running code is practice, not an automatic grade for the mission.

Brief

Plan an isolated restore, verify the recovered data, and calculate RPO and RTO from a simple timeline.

Imani puts a post-crash report and an older archive in front of you. Voss claims the report never omitted a transfer. Mara asks for a repeatable demonstration in a separate practice lab before the fictional meeting. Do not change original databases or expose secrets. The urgency is part of the story; the exercise has no timer.

Your mission

  1. Put pg_dump, pg_restore --list, a separate database, pg_restore, and SQL verification in order.
  2. Name the two identifiers expected in the backup and the one absent from the report.
  3. Calculate scenario RPO and complete return from failure; compare them with 60- and 45-minute targets.
  4. Write a careful conclusion about what the difference between copy and report shows.

How to check your work

  • Archive inspected and restored only to a practice destination.
  • R1 and TRANSFER-7 recovered; TRANSFER-7 missing from report.
  • RPO 30 min ≤ 60; full return 50 min > 45.
  • The discrepancy is confirmed, but its cause and author remain unknown.

Course example

from datetime import datetime

def clock(value):
    return datetime.strptime(value, "%H:%M")

backup_at = clock("20:50")
failure_at = clock("21:20")
restore_started = clock("21:30")
restore_verified = clock("22:10")
rpo_minutes = int((failure_at - backup_at).total_seconds() / 60)
restore_phase_minutes = int((restore_verified - restore_started).total_seconds() / 60)
rto_minutes = int((restore_verified - failure_at).total_seconds() / 60)
backup_events = {"R1", "TRANSFER-7"}
restored_events = {"R1", "TRANSFER-7"}
published_report = {"R1"}

print("RPO", rpo_minutes, "minutes")
print("restore_phase", restore_phase_minutes, "minutes")
print("RTO", rto_minutes, "minutes")
print("restored_matches_backup", restored_events == backup_events)
print("missing_from_report", sorted(restored_events - published_report))

Code

Use Tab to leave the editor. Ctrl+Enter runs the source. The lines beginning with # are task reminders. Python ignores them. Write your code beneath them.

Python console

Loading laboratory…

Explore Python or SQL here; this is not an operating-system shell.

This is a disposable browser experiment. The code run here is not recorded as a completed mission.

Each command starts a fresh disposable worker: it runs a captured copy of your current source, then your command with the lesson fixtures. Changes are discarded afterward. Commands never save source or award XP. Ctrl+Enter executes the command.

Virtual workspace files

Source and declarative assets are readable here without JavaScript. Python input files are created at runtime; SQL setup initializes the disposable database.

source.py

Current editor source. Inspection shows your current edits.

# Put pg_dump, pg_restore --list, a separate database, pg_restore, and SQL verification in order.
# Name the two identifiers expected in the backup and the one absent from the report.
# Calculate scenario RPO and complete return from failure; compare them with 60- and 45-minute targets.
# Write a careful conclusion about what the difference between copy and report shows.

exemple.py

Declarative lesson asset; this is not a file created in the Python filesystem.

from datetime import datetime

def clock(value):
    return datetime.strptime(value, "%H:%M")

backup_at = clock("20:50")
failure_at = clock("21:20")
restore_started = clock("21:30")
restore_verified = clock("22:10")
rpo_minutes = int((failure_at - backup_at).total_seconds() / 60)
restore_phase_minutes = int((restore_verified - restore_started).total_seconds() / 60)
rto_minutes = int((restore_verified - failure_at).total_seconds() / 60)
backup_events = {"R1", "TRANSFER-7"}
restored_events = {"R1", "TRANSFER-7"}
published_report = {"R1"}

print("RPO", rpo_minutes, "minutes")
print("restore_phase", restore_phase_minutes, "minutes")
print("RTO", rto_minutes, "minutes")
print("restored_matches_backup", restored_events == backup_events)
print("missing_from_report", sorted(restored_events - published_report))