← All scenarios

Scenario · Storage & Backup

Restore to wrong target

A sandboxed PostgreSQL incident — investigate with your own tools, submit a fix, and get deterministic Detect / Fix / Trap scoring.

L3 · 10–15 min · runs locally in Docker

Launch

Start this scenario

Boot it in a real PostgreSQL sandbox and investigate with psql, EXPLAIN and pg_stat_statements.

ride postgres start stage-05/06-restore-to-wrong-target

Part of these paths

Show the postmortem & investigation hints spoilers
Restore to wrong target
Type: incident simulation · Topic: Storage & Backup · Level: L3 · Duration: 10–15 min
Launch: ride postgres start stage-05/06-restore-to-wrong-target

POSTMORTEM (root cause · how it was found · the fix · lesson)
Root cause: a restore ran and reported success, but it restored the wrong backup
— the target ended up holding the 'customer_b' snapshot when 'customer_a' was
expected. Technically the restore worked; operationally it was wrong, and a
'restore complete' message hid that.

How it was found: verifying the restored data (restore_markers) and the target's
identity (current_database / port) showed the wrong snapshot in place.

The mitigation: restore the correct backup (`pgpg action restore-correct`); the
marker then matched the expected snapshot.

Lesson: never trust a restore blindly — verify the target identity, the
timestamp, and the actual data against what you expected. Restoring is only done
when the right data is in the right place; an index is irrelevant.

INVESTIGATION HINTS (the staged path to diagnose and fix)
1. A restore 'succeeded', but did it restore the RIGHT thing? Verify what's actually in the target: SELECT * FROM restore_markers; and confirm identity (SELECT current_database(), inet_server_port();). The marker is the wrong snapshot.
2. The target holds 'customer_b' but the expected snapshot is 'customer_a' — the wrong backup was restored. A green 'restore complete' doesn't mean the right data landed.
3. Restore the correct backup: `pgpg action <session> restore-correct`. Then restore_markers shows 'customer_a'. Don't declare success without verifying, and don't add indexes.