public inbox for [email protected]  
help / color / mirror / Atom feed
From: Josh Berkus <[email protected]>
To: Kevin Grittner <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: Sample archive_command is still problematic
Date: Mon, 11 Aug 2014 10:59:36 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <WM!2e9e963ef1fa06e085aa9dbf135a205b718dad5470c1598eeabb71225f19676528ed8e4fad97f9075cbabdcbac8b68ac!@asav-1.01.com>
References: <[email protected]>
	<[email protected]>
	<WM!2e9e963ef1fa06e085aa9dbf135a205b718dad5470c1598eeabb71225f19676528ed8e4fad97f9075cbabdcbac8b68ac!@asav-1.01.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>

On 08/11/2014 10:21 AM, Kevin Grittner wrote:
>> Is there some good reason why "test ! -f" was added to the
>> sample?
> 
> In an environment with more than one cluster archiving, it is
> otherwise way too easy to copy a config file and have the WAL files
> of the two systems overwriting one another.  I consider a check for
> an already existing file on the target to be very good practice.
> The errors in the log are a clue that something went wrong, and
> gives you a chance to fix things without data loss.

It depends on what you're guarding against.  In the case I was dealing
with, the master crashed in the middle of an archive write.  As a
result, the file existed, but was incomplete, and *needed* to be
overwritten.  But because of 'test -f' archiving just kept failing.

> The problem with the recommended command is that cp is not atomic.
> The file can be read before the contents are materialized, causing
> early end to recovery.  I have seen it happen.  The right way to do
> this is to copy to a different name or directory and mv the file
> into place once it is complete -- or use software which does that
> automatically, like rsync does.

Yeah, realistically, I think we need to start supplying a script or two
in /contrib and referencing that.  I'm not sure how to make it work for
the Windows users though.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



view thread (25+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Sample archive_command is still problematic
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox