Skip to main content
Kill -9 Club
Sign in

restore drill (restore rehearsal)

Backups

Restoring a real archive into a throwaway target, then counting what came back. A non-empty file and a passing gzip -t prove the bytes are readable; they say nothing about the contents, and they succeed just as happily on the truncated archive a failing pg_dump left behind. Only the sequence settles it: sudo -u postgres createdb restore_check, pg_restore --dbname=restore_check, then psql -tAc 'SELECT count(*) FROM users' compared against production. A command that exits without error on an empty table is the most common failure mode there is. Never restore the test over production, and wrap the temporary database in a trap '...' EXIT so a failure does not leave one behind. The drill also gives you the number nobody has: the duration. Six hours against a two-hour commitment is an architecture problem, and better found on a Tuesday afternoon.

Also written: restore rehearsal, restore test