Re: confusing archive_command example

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: confusing archive_command example
Date: 2010-04-01 12:17:37
Message-ID: 4BB48EE1.2050303@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Peter Eisentraut wrote:
> On ons, 2010-03-31 at 19:51 -0400, Bruce Momjian wrote:
>
>> Also, should we be using test ! -e instead of -f?
>>
>
> test -e is not portable.
>

Right; there are plenty of shells where "test -e" isn't implemented, I
believe some Solaris and/or HP-UX systems have that issue. The original
"test -f" was already the best example to give here.

As for the update Josh suggested, there are two issues here. The PITR
documentation at
http://developer.postgresql.org/pgdocs/postgres/continuous-archiving.html
starts with this example:

archive_command = 'cp -i %p /mnt/server/archivedir/%f </dev/null'

And then it used to show this one (now it has 'test -e'):

archive_command = 'test ! -f .../%f && cp %p .../%f'

I agree this is confusing. That second line should just read like this
to match the other examples:

archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p
/mnt/server/archivedir/%f'

And to revert the "test -e" change.

The third issue here, not mentioned yet, is that there's also an example
of setting up archive_command in its GUC documentation:

http://developer.postgresql.org/pgdocs/postgres/runtime-config-wal.html

This has drifted out of sync with the section being updated here this
week--its archive_command example isn't even using "-i". I think the
right thing to do here is to migrate the Windows example out of 18.5.3
from 24.3.1, then replace the existing examples in 18.5.3 to instead
suggest 24.3.1 has them. Given that all of this documentation giving
examples for how to correctly configure that parameter, like this cp
trivia, only appears in the PITR docs section, I don't see any reason to
duplicate that in the GUC area. Having the second, minimally documented
version of those in 18.5.3 just encourages people to use what we know is
a bad practice by providing them as examples.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Heikki Linnakangas 2010-04-01 13:09:32 Re: [HACKERS] Streaming replication document improvements
Previous Message Peter Eisentraut 2010-04-01 05:25:24 Re: confusing archive_command example