Skip site navigation (1) Skip section navigation (2)

Re: somewhat wrong archive_command example

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Greg Smith <greg(at)2ndquadrant(dot)com>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: somewhat wrong archive_command example
Date: 2012-08-30 01:57:28
Message-ID: 1346291848.17422.11.camel@vanquo.pezone.net (view raw or flat)
Thread:
Lists: 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.




In response to

Responses

pgsql-docs by date

Next:From: Magnus HaganderDate: 2012-08-30 09:15:30
Subject: Re: somewhat wrong archive_command example
Previous:From: Bruce MomjianDate: 2012-08-30 01:14:40
Subject: Re: CREATE USER

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group