Diagnostic step 1
Stop the standby PostgreSQL instance to avoid further apply attempts and copy the entire pg_wal/pg_wal/archive status to a safe location for forensic investigation.
Generated Oct 19, 2026, 9:33:36 AM
Stop the standby PostgreSQL instance to avoid further apply attempts and copy the entire pg_wal/pg_wal/archive status to a safe location for forensic investigation.
Run pg_waldump on the WAL segment reported bad to confirm corruption and note LSN ranges. Inspect archive dir timestamps and sizes for partial files (files < 16MB indicate truncation).
Check for timeline history files in archive; compare timeline IDs (pg_control, pg_controldata) between primary and standby. If history files missing, fetch them from primary or backups.
If intact WAL segments for the gap exist on the primary or an offsite archive, copy them into the archive and try restart. If necessary WAL segments are irretrievably corrupted/missing, take a new base backup (pg_basebackup) from primary and rebuild standby.
If unsure, escalate to a DBA: do not attempt forceful modifications to WAL or timeline files without backups (risk of data loss).