Re: [HACKERS] pg_archivecleanup bug (invalid filename input)

2015-06-10 Thread Michael Paquier
On Wed, Jun 10, 2015 at 12:29 PM, Joshua D. Drake j...@commandprompt.com 
wrote:

 On 06/09/2015 05:54 PM, Michael Paquier wrote:

 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.


 O.k so I would say: Should we adjust this behavior? It seems to me that
 it should accept a path.

Perhaps others have a different opinion, but I don't see much the
point. First, archive_cleanup_command uses %r with only a segment file
name. Then, in the case where pg_archivecleanup is called within a
script and that the segment name is retrieved from a given path that
you may want to append, this script is going to scan this directory to
fetch the segment file name anyway, actually killing the purpose of
appending a path.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] pg_archivecleanup bug (invalid filename input)

2015-06-09 Thread Joshua D. Drake


Hello,

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 
0001074800B1.00015838.backup


Works.

/usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive 
./0001074800B1.00015838.backup


Or

/usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive 
/backups/db1/archive/0001074800B1.00015838.backup


Do not and present with the error mentioned above.

CentOS 6.6 with PGDG rpms.

Sincerely,

JD

--
Command Prompt, Inc. - http://www.commandprompt.com/  503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Announcing I'm offended is basically telling the world you can't
control your own emotions, so everyone else should do it for you.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] pg_archivecleanup bug (invalid filename input)

2015-06-09 Thread Michael Paquier
On Wed, Jun 10, 2015 at 7:27 AM, Joshua D. Drake j...@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
 0001074800B1.00015838.backup
 Works.

Yes.

 /usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive
 ./0001074800B1.00015838.backup
 Or
 /usr/pgsql-9.4/bin/pg_archivecleanup /backups/db1/archive
 /backups/db1/archive/0001074800B1.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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] pg_archivecleanup bug (invalid filename input)

2015-06-09 Thread Joshua D. Drake


On 06/09/2015 05:54 PM, Michael Paquier wrote:


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.


O.k so I would say: Should we adjust this behavior? It seems to me 
that it should accept a path.


JD




--
Command Prompt, Inc. - http://www.commandprompt.com/  503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Announcing I'm offended is basically telling the world you can't
control your own emotions, so everyone else should do it for you.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers