Hi, I have a scenario where max_wal_size = 10GB and wal_recycle = on, the postgres starts to recycle and keep WAL files for future use, eventually around 600~ WAL files have been kept in the pg_wal directory. The checkpoints were happening at regular intervals. But the disk was about to get full (of course scaling up disk is an option) but to avoid "no space left on device" crashes, changed max_wal_size = 5GB, and issued a checkpoint, thinking that postgres will free up the 5GB of disk space. It seems like that's not the case because postgres will not remove future WAL files even after max_wal_size is reduced, but if it can delete the future WAL file(s) immediately, the server would have had 5GB free disk space to keep the server up avoiding crash and meanwhile disk scaling can be performed.
Can postgres delete the recycled future WAL files once max_wal_size is reduced and/or wal_recycle is set to off? Thoughts? Regards, Bharath Rupireddy.