WAL segment deletion causes replication lag and requires replica rebuild
criticalReplicationUpdated Mar 4, 2026
Technologies:
How to detect:
Replication breaks when primary node deletes WAL files that replica still needs. Caused by network issues combined with insufficient wal_keep_segments or max_wal_senders settings, or too-frequent checkpoints during high traffic. Replica cannot continue replication without required WAL segments.
Recommended action:
Increase wal_keep_segments parameter to retain more WAL files in pg_xlog directory. Increase max_wal_senders to allow more concurrent WAL sender processes. Enable archive_mode and configure archive_command to preserve WAL files to alternate location. If WAL already deleted, rebuild replica from backup. Monitor replication lag to detect issues before WAL deletion occurs.