WAL rotation
The management of the write-ahead log's segment files: when a segment fills up it's swapped for a new one, and old segments are reused, archived, or deleted once no longer needed. It determines how much disk space the WAL takes.
Mechanic: WAL is written in fixed segments (16 MB in PostgreSQL); when one fills it rotates to the next. A segment may only be reused/deleted once its changes are safely applied (checkpoint done) AND everyone who needs it is done — replicas (replication slots), archiving (PITR), and ongoing backups. Pitfall: if a replica hangs or archiving fails, old WAL segments can't be freed → they accumulate and can fill the disk, one of the most common Postgres operational incidents. Tuning: max_wal_size, checkpoint frequency, monitoring of replication lag and archive status. Directly tied to the checkpoint mechanism. Related to WAL and checkpoint.