Reputation: 550
As per replication slot definition, it is a feature in PostgreSQL that ensure that the master server will retain the WAL logs that are needed by the replicas even when they are disconnected from server.
Is there any effect if I run pg_archivecleanup command every 15th day of month to free my storage. Does it has any effect on replication slot, since it is tracing WAL file which is required by standby server?
Because I run pg_archivecleanup removing WAL file from last checkpoint but I am not sure whether it is removing WAl file that is required for other replica.
If not removing then how it is actually tracing it?
I am looking for explanation from experts.
Upvotes: 1
Views: 619
Reputation: 246483
When you run pg_archivecleanup
, PostgreSQL will delete all WAL segments that are older than the WAL segment you specify as argument. This will ignore replication slots, you you may end up removing WAL segments that may still be needed by standby servers to catch up (if they do that using restore_command
).
Note that this normally not a problem, because pg_archivecleanup
deletes WAL segments from the archive, while replication slots deal with WAL segments on the primary server (in the pg_wal
directory), which are not affected by pg_archivecleanup
. Now since the standby consumes WAL directly from the primary (as specified in primary_conninfo
), it does not have to rely on the WAL archives.
Upvotes: 1