Allow pg_archivecleanup to remove backup history files
torikoshia <torikoshia@oss.nttdata.com>
From: torikoshia <torikoshia@oss.nttdata.com>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2023-04-25T07:38:16Z
Lists: pgsql-hackers
Attachments
- v1-0001-Allow-pg_archivecleanup-to-remove-backuphistoryfile.patch (text/x-diff) patch v1-0001
Hi, Currently pg_archivecleanup doesn't remove backup history files even when they're older than oldestkeptwalfile. Of course the size of backup history files are smaller than WAL files and they wouldn't consume much disk space, but a lot of backup history files(e.g. daily backup for years) whose backups data have been already removed are unnecessary and I would appreciate if pg_archivecleanup has an option to remove them. Attached a PoC patch, which added new option -b to remove files including backup history files older than oldestkeptwalfile. $ ls archivedir 000000010000000000000001 000000010000000000000003 000000010000000000000006 000000010000000000000008 000000010000000000000002 000000010000000000000004 000000010000000000000007 000000010000000000000009 000000010000000000000002.00000028.backup 000000010000000000000005 000000010000000000000007.00000028.backup 00000001000000000000000A.partial $ pg_archivecleanup -b archivedir 000000010000000000000009 $ ls archivedir 000000010000000000000009 00000001000000000000000A.partial Any thoughts? -- Regards, -- Atsushi Torikoshi NTT DATA CORPORATION
Commits
-
pg_archivecleanup: Add --clean-backup-history
- 3f8c98d0b631 17.0 landed
-
pg_archivecleanup: Refactor loop doing old segment removals
- 4a7556f77c44 17.0 landed
-
Introduce long options in pg_archivecleanup
- dd7c60f1935a 17.0 landed