What is the correct way to cleanup PostgreSQL's WAL? I have a database with more than 100 GB and it has around 600 GB in pg_wal. Also I have 2 logical replications set up.
Primary and replicas are running PostgreSQL 10.
Primary and replicas have commented wal_keep_segments and max_wal_size.
pg_archivecleanup did not work with %r option, then I got the archive name by searching in pg_controldata latest checkpoint's REDO WAL file and deleted the logs, but then one replica stopped with the error
could not receive data from WAL stream: FATAL: requested WAL segment xxx has already been removed
To solve this I deleted and recreated the replica.