Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T6u0k-0002Ds-GV for pgsql-docs@postgresql.org; Thu, 30 Aug 2012 01:57:34 +0000 Received: from mailout-de.gmx.net ([213.165.64.23]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1T6u0j-0007V0-2j for pgsql-docs@postgresql.org; Thu, 30 Aug 2012 01:57:33 +0000 Received: (qmail invoked by alias); 30 Aug 2012 01:57:30 -0000 Received: from pool-108-52-108-253.phlapa.fios.verizon.net (EHLO [192.168.1.4]) [108.52.108.253] by mail.gmx.net (mp035) with SMTP; 30 Aug 2012 03:57:30 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX18PThYJcUkPahi9yeqeJGN61lOMwnYCWvL33zlHGy Jl9doadtqNCdVq Message-ID: <1346291848.17422.11.camel@vanquo.pezone.net> Subject: Re: somewhat wrong archive_command example From: Peter Eisentraut To: Bruce Momjian Cc: Josh Kupershmidt , Greg Smith , Euler Taveira de Oliveira , pgsql-docs@postgresql.org Date: Wed, 29 Aug 2012 21:57:28 -0400 In-Reply-To: <20120827134641.GD11088@momjian.us> References: <4E794FB5.80400@2ndQuadrant.com> <1316613536.14119.6.camel@fsopti579.F-Secure.com> <4E7A6D0D.4060106@2ndQuadrant.com> <4E7A887F.8010908@timbira.com> <20120816011347.GF8353@momjian.us> <502EA0D0.10004@gmx.net> <20120825230755.GE10814@momjian.us> <20120825234026.GG10814@momjian.us> <1346039025.5873.16.camel@vanquo.pezone.net> <20120827134641.GD11088@momjian.us> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Pg-Spam-Score: -2.1 (--) X-Archive-Number: 201208/49 X-Sequence-Number: 7442 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.