Re: Allow pg_archivecleanup to remove backup history files - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Allow pg_archivecleanup to remove backup history files
Date
Msg-id ZHBBarvyNq2FY82v@paquier.xyz
Whole thread Raw
In response to Re: Allow pg_archivecleanup to remove backup history files  (torikoshia <torikoshia@oss.nttdata.com>)
Responses Re: Allow pg_archivecleanup to remove backup history files
List 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

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Allow pg_archivecleanup to remove backup history files
Next
From: Peter Eisentraut
Date:
Subject: Re: testing dist tarballs