Re: problem with archive_command as suggested by documentation

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: Heikki Linnakangas *EXTERN* <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: problem with archive_command as suggested by documentation
Date: 2009-01-23 15:15:10
Message-ID: 1232723710.2327.1207.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Gupta 2009-01-23 15:19:23 Re: Table Partitioning Feature
Previous Message Tom Lane 2009-01-23 15:14:04 Re: AIX 4.3 getaddrinfo busted