Re: pg_archivecleanup bug (invalid filename input)

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_archivecleanup bug (invalid filename input)
Date: 2015-06-10 00:54:22
Message-ID: CAB7nPqTnHP7GVSV_Ab=R4iaB3gU6nwiQ1upkHp7pP-jBG0VB3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 10, 2015 at 7:27 AM, Joshua D. Drake <jd(at)commandprompt(dot)com> wrote:
> Trying to use pg_archivecleanup as a:
>
> "standalone archive cleaner"
>
> Results in an error of:
>
> pg_archivecleanup: invalid filename input
> Try "pg_archivecleanup --help" for more information.
>
> /usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive
> 0000000100000748000000B1.00015838.backup
> Works.

Yes.

> /usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive
> ./0000000100000748000000B1.00015838.backup
> Or
> /usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive
> /backups/db1/archive/0000000100000748000000B1.00015838.backup
> Do not and present with the error mentioned above.

Looking at the documentation what is expected is not a path to a
segment file, but only a segment file name:
http://www.postgresql.org/docs/devel/static/pgarchivecleanup.html
So the current behavior is correct, it is actually what
SetWALFileNameForCleanup(at)pg_archivecleanup(dot)c checks in the code.

Speaking of which, 179cdd09 has forgotten pg_archivecleanup.c, making
XLOG_DATA_FNAME_LEN not needed. XLOG_BACKUP_FNAME_LEN could be removed
as well and IsBackupHistoryFileName() should be made smarter by
checking that the length of the backup file name is actually 40...

Regards,
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-06-10 01:09:07 Re: Checkpoints vs restartpoints
Previous Message Bruce Momjian 2015-06-10 00:33:56 Re: Checkpoints vs restartpoints