Re: Sample archive_command is still problematic - Mailing list pgsql-docs

From Tom Lane
Subject Re: Sample archive_command is still problematic
Date
Msg-id 28492.1407786573@sss.pgh.pa.us
Whole thread Raw
In response to Re: Sample archive_command is still problematic  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-docs
Kevin Grittner <kgrittn@ymail.com> writes:
> Josh Berkus <josh@agliodbs.com> wrote:
>> Yeah, realistically, I think we need to start supplying a script or two
>> in /contrib and referencing that.� I'm not sure how to make it work for
>> the Windows users though.

> That might work.� We should do something, though.� The example we
> give in the docs is not production quality IMO, and is something of
> an embarrassment.

Well, it's not really intended to be production grade, and I think the
docs say so (perhaps not emphatically enough).

> The problem is, it may be hard to get agreement
> on what that should look like.� As a DBA, I insisted on the check
> for an existing file.� I also insisted on having scripts send an
> email to the DBAs on the first occurrence of a failure (but not to
> spam us on each and every failed attempt).

As soon as you get into requirements like "send me email on failure",
I think we're well past what we'd want as a documentation example.
Conceivably we could put such a script in contrib though.

The problem with such things as sample scripts is that it might get hard
for people to tell the difference between barnacles (like email ;-))
and properties that they'd better preserve in any custom script.
The documentation is primarily trying to make the point that the archive
action must not overwrite any existing file (which is such a property)
and that's why it has the test ! -f.  It doesn't really address the
question of appropriate error handling, which is what Josh is on about.

It's possible that something like

test ! -f $target && cp $source $target.tmp && mv $target.tmp $target

adds enough robustness to be worth recommending.  But it should go
along with docs changes to emphasize that error handling is another
important property to worry about.

            regards, tom lane


pgsql-docs by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Sample archive_command is still problematic
Next
From: Josh Berkus
Date:
Subject: Re: Sample archive_command is still problematic