PostgreSQL standby reports 'invalid checksum' and stops applying WAL after incremental base backup restore
Environment
Primary PostgreSQL 14 on Ubuntu 22.04 with WAL archiving to an rsync‑backed archive directory. Standby restored from an incremental backup snapshot of the archive and configured for streaming + restore_command reading from archive dir.
Symptoms
Standby crashes apply process with errors like 'invalid checksum in record at X' and refuses to continue. Replication slot on primary shows WAL not streamed; standby lag stalls at last valid LSN. Applications still write to primary.
Observations
restore_command returns files successfully but pg_waldump shows malformed records at the reported LSN. The archive directory contains WAL segments with modified timestamps and some segments smaller than 16MB. A timeline file (.history) appears missing or belongs to a prior promotion.
Already attempted
Replayed older WALs with pg_waldump to isolate the corruption range, re‑rsynced archive directory from primary, restarted standby. Stopping/starting postgres on standby does not progress apply. Tried copying specific WAL segments from primary but history mismatch prevented apply.
Question
How can I recover the standby and resume WAL apply without losing replication continuity? What checks and recovery steps are safe to run now?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Databases43% match
PostgreSQL standby stops applying WAL with 'invalid record length' after pg_upgrade and manual archive restore
Open0 answers - Databases41% match
PostgreSQL standby stops applying WAL after pg_basebackup restore — replication slot grows and disk fills
Open0 answers - Databases39% match
PostgreSQL standby stops applying WAL during long-running transactions on primary after pg_basebackup restore
Open0 answers - Databases32% match
Primary PostgreSQL WAL directory fills after interrupted base backup and failing archive_command
Open0 answers - Databases31% match
PostgreSQL WAL archiving stalls during pg_basebackup when archive_command uses rsync over SSH
Open0 answers