Re: pg_archivecleanup bug (invalid filename input) - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_archivecleanup bug (invalid filename input)
Date
Msg-id CAB7nPqTnHP7GVSV_Ab=R4iaB3gU6nwiQ1upkHp7pP-jBG0VB3g@mail.gmail.com
Whole thread Raw
In response to pg_archivecleanup bug (invalid filename input)  ("Joshua D. Drake" <jd@commandprompt.com>)
Responses Re: pg_archivecleanup bug (invalid filename input)  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-hackers
On Wed, Jun 10, 2015 at 7:27 AM, Joshua D. Drake <jd@commandprompt.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@pg_archivecleanup.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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Checkpoints vs restartpoints
Next
From: Michael Paquier
Date:
Subject: Re: Checkpoints vs restartpoints