Menu

1 / 2

PostgreSQL Restore Failures: It Wasn’t pgBackRest, It Was My Recovery Logic

DEV Community·Mohamed Hussain S·6 months ago
#POKsgjEo
#another#postgres#recovery#postgresql#restore
Reading 0:00
15s threshold

I was building and testing a PostgreSQL backup and restore workflow using pgBackRest.

The idea was simple:

take backups

restore them automatically

validate the database

make recovery predictable

Instead, I ended up repeatedly breaking PostgreSQL recovery itself.

At one point, PostgreSQL refused to start entirely, the application depending on it failed to start, and I started seeing errors like:

invalid checkpoint record could not locate a valid checkpoint record at 0/DEAD

Enter fullscreen mode

Exit fullscreen mode

Later, I also hit timeline mismatch errors like:

ERROR: [058]: target timeline 3 forked from backup timeline 2

Enter fullscreen mode

Exit fullscreen mode

At first, I thought:

pgBackRest restores were corrupting PostgreSQL.

That assumption turned out to be completely wrong.

The real problem was the way I was handling recovery.

What I Was Building

I was testing a PostgreSQL backup/restore flow locally after repeated restore failures elsewhere.

To isolate the issue properly, I…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.