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