Re: somewhat wrong archive_command example - Mailing list pgsql-docs

From Peter Eisentraut
Subject Re: somewhat wrong archive_command example
Date
Msg-id 1346291848.17422.11.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: somewhat wrong archive_command example  (Bruce Momjian <bruce@momjian.us>)
Responses Re: somewhat wrong archive_command example  (Magnus Hagander <magnus@hagander.net>)
List pgsql-docs
On Mon, 2012-08-27 at 09:46 -0400, Bruce Momjian wrote:
> I thought the idea was just to show what a shell script might look like
> --- we could say it does the same as a single-line copy, but then people
> could improve it, or we could add a comment to show how people could
> improve it.

Why can't we provide the improved version to begin with, if we know it
needs improvement?  I think we don't really know what it should look
like, do we?

> I am actually unclear how the partial copy problem would not be fixed by
> just using cp without -i < /dev/null.

Sure, that would do it, but elsewhere we also say that the command
should guard against overwriting existing files.  That's a safety
measure against overwriting existing archives due to configuration
mistakes, which is fair enough.  So there is still something that needs
refining.  Either

- We don't care about the partial copy problem, or

- We don't care about the overwriting existing archives issue, or

- We make the copy quasi-atomic using mktemp + mv (could also use the
"install" program, I think), or

- We make the file names absolutely unique by adding the system ID or a
UUID of some kind.

> > I think what we should do is write a wrapper program in C that covers
> > all the bases, support all platforms, and supports a handful of the most
> > commonly used copy methods (cp, scp, etc. + compression).  Then everyone
> > can just use that and doesn't have to figure all these things out from
> > scratch every time.
>
> I doubt it would work because people like the flexibility of shell
> scripts.

Well, we thought that about the base backup, but now we have
pg_basebackup, which supports two output methods that should cover most
cases.  If we could provide an archive command that has two or three
methods, that could also cover most uses.  Of course, in either case you
are free to write your own script.




pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: CREATE USER
Next
From: Magnus Hagander
Date:
Subject: Re: somewhat wrong archive_command example