Re: problem with archive_command as suggested by documentation - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: problem with archive_command as suggested by documentation
Date
Msg-id 1232723710.2327.1207.camel@ebony.2ndQuadrant
Whole thread Raw
In response to Re: problem with archive_command as suggested by documentation  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Responses Re: problem with archive_command as suggested by documentation
List pgsql-hackers
On Fri, 2009-01-23 at 08:20 +0100, Albe Laurenz wrote:

> > Perhaps it should suggest 
> > something like:
> > 
> > test ! -f .../%f && cp %p .../%f.tmp && mv .../%f.tmp .../%f
> > 
> > ie. copy under a different filename first, and rename the file in place 
> > after it's completely written, assuming that mv is atomic. It gets a bit 
> > complicated, though.
> 
> That's a good idea (although it could lead to race conditions in the
> extremely rare case that two clusters want to archive equally named
> files at the same time).
> 
> I'll write a patch for that and send it as basis for a discussion.

The example is to help you understand things, not to solve every case. I
think it should start simply and then have additional comments later.

I don't think that particular example is a good one since the whole
point of the archive is that it should be off-server. If we're going to
be exact about the example then we should give a more realistic one,
like using scp. Unfortunately, there is no secure-remote-move command,
so doing the above with scp would resend the whole file 3 times. I think
it's better to write a script...

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Training, Services and Support



pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: AIX 4.3 getaddrinfo busted
Next
From: Gregory Stark
Date:
Subject: Re: Controlling hot standby