Re: Allow pg_archivecleanup to remove backup history files
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-05-26T05:19:38Z
Lists: pgsql-hackers
On Thu, May 25, 2023 at 11:51:18PM +0900, torikoshia wrote:
> Updated patches according to your comment.
- ok(!-f "$tempdir/$walfiles[1]",
- "$test_name: second older WAL file was cleaned up");
- ok(-f "$tempdir/$walfiles[2]",
+ ok(!-f "$tempdir/@$walfiles[1]",
+ "$test_name: second older WAL/backup history file was cleaned up");
+ ok(-f "$tempdir/@$walfiles[2]",
This is still a bit confusing, because as designed the test has a
dependency on the number of elements present in the list, and the
description of the test may not refer to what's actually used (the
second element of each list is either a WAL segment or a backup
history file). I think that I would just rewrite that so as we have a
list of WAL segments in an array with the expected result associated
to each one of them. Basically, something like that:
my @wal_segments = (
{ name => "SEGMENT1", present => 0 },
{ name => "BACKUPFILE1", present => 1 },
{ name => "SEGMENT2", present => 0 });
Then the last part of run_check() would loop through all the elements
listed.
--
Michael
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