pg_archivecleanup - add the ability to detect, archive and delete the unneeded wal files on the primary - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject pg_archivecleanup - add the ability to detect, archive and delete the unneeded wal files on the primary
Date
Msg-id CALj2ACWrryWEbzn3gU9yqyarY5ptsUd8wrLwNgfv+Xn4tepRJQ@mail.gmail.com
Whole thread Raw
Responses Re: pg_archivecleanup - add the ability to detect, archive and delete the unneeded wal files on the primary  ("Euler Taveira" <euler@eulerto.com>)
List pgsql-hackers
Hi,

pg_archivecleanup currently takes a WAL file name as input to delete
the WAL files prior to it [1]. As suggested by Satya (cc-ed) in
pg_replslotdata thread [2], can we enhance the pg_archivecleanup to
automatically detect the last checkpoint (from control file) LSN,
calculate the lowest restart_lsn required by the replication slots, if
any (by reading the replication slot info from pg_logical directory),
archive the unneeded (an archive_command similar to that of the one
provided in the server config can be provided as an input) WAL files
before finally deleting them? Making pg_archivecleanup tool as an
end-to-end solution will help greatly in disk full situations because
of WAL files growth (inactive replication slots, archive command
failures, infrequent checkpoint etc.).

Thoughts?

[1] - When used as a standalone program all WAL files logically
preceding the oldestkeptwalfile will be removed from archivelocation.
https://www.postgresql.org/docs/devel/pgarchivecleanup.html
[2] - https://www.postgresql.org/message-id/CAHg%2BQDc9xwN7EmuONT3T91pCqFG6Q-BCe6B-kM-by7r1uPEicg%40mail.gmail.com

Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: more descriptive message for process termination due to max_slot_wal_keep_size
Next
From: Amul Sul
Date:
Subject: Re: Multi-Column List Partitioning