Re: Dry-run mode for pg_archivecleanup

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Gabriele Bartolini <gabriele(dot)bartolini(at)2ndquadrant(dot)it>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Dry-run mode for pg_archivecleanup
Date: 2012-01-27 22:43:51
Message-ID: CAK3UJRFEEjd8aqqO0rEcVaP-RkZCBsWe9HS2VpdKpcGhdWAqZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 27, 2012 at 9:47 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Sun, Jan 15, 2012 at 5:05 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>> On Sun, Jan 15, 2012 at 3:02 PM, Gabriele Bartolini
>> <gabriele(dot)bartolini(at)2ndquadrant(dot)it> wrote:
>>
>>> My actual intention was to have the filename as output of the command, in
>>> order to easily "pipe" it to another script. Hence my first choice was to
>>> use the stdout channel, considering also that pg_archivecleanup in dry-run
>>> mode is harmless and does not touch the content of the directory.
>>
>> Oh, right - I should have re-read your initial email before diving
>> into the patch. That all makes sense given your intended purpose. I
>> guess your goal of constructing some simple way to pass the files
>> which would be removed on to another script is a little different than
>> what I initially thought the patch would be useful for, namely as a
>> testing/debugging aid for an admin.
>>
>> Perhaps both goals could be met by making use of '--debug' together
>> with '--dry-run'. If they are both on, then an additional message like
>> "pg_archivecleanup: would remove file ... " would be printed to
>> stderr, along with just the filename printed to stdout you already
>> have.
>
> This email thread seems to have trailed off without reaching a
> conclusion.  The patch is marked as Waiting on Author in the
> CommitFest application, but I'm not sure that's accurate.  Can we try
> to nail this down?

Perhaps my last email was a bit wordy. The only real change I am
suggesting for Gabriele's patch is that the message printed to stderr
when debug + dryrun are activated be changed to "would remove file
..." from "removing file", i.e around line 124:

if (debug)
fprintf(stderr, "%s: %s file \"%s\"\n",
progname, (dryrun ? "would remove" : "removing"),
WALFilePath);

Other than that little quibble, I thought the patch was fine.

Josh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-01-27 22:55:55 Re: Dry-run mode for pg_archivecleanup
Previous Message Dan Scales 2012-01-27 22:31:54 double writes using "double-write buffer" approach [WIP]