A replication slot — logical or physical — has stopped consuming WAL, and the pg_wal/ directory is growing without bound.
Diagnose it
-- Slot status and WAL retained:
SELECT slot_name,
slot_type,
active,
active_pid,
wal_status,
safe_wal_size,
pg_size_pretty(
pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
) AS retained_bytes,
inactive_since, -- PostgreSQL 17+
invalidation_reason -- PostgreSQL 17+
FROM pg_replication_slots
ORDER BY pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) DESC NULLS LAST;
A slot with active = false and wal_status = 'lost' or
'unreserved' means WAL it needs has already been recycled — the slot is broken
and must be dropped.
Why it happens
PostgreSQL retains WAL segments until every slot’s restart_lsn has advanced
past them. A slot belonging to a logical replication subscriber that has gone offline,
a downstream service that has paused, or a slot created for testing and never dropped,
will silently accumulate retained WAL until disk space is exhausted.