Re: pg_xlog - files are guaranteed to be sequentialy named? - Mailing list pgsql-general

From Greg Smith
Subject Re: pg_xlog - files are guaranteed to be sequentialy named?
Date
Msg-id Pine.GSO.4.64.0706131132240.3220@westnet.com
Whole thread Raw
In response to Re: pg_xlog - files are guaranteed to be sequentialy named?  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: pg_xlog - files are guaranteed to be sequentialy named?  (Johannes Konert <jkonert@t3go.de>)
List pgsql-general
On Wed, 13 Jun 2007, Alvaro Herrera wrote:

> Johannes Konert wrote:
>> I currently write a small script that deletes outdated xlog-files from
>> my backup-location.
>
> Warning, this is NOT SAFE to do.  You should NEVER delete "outdated"
> xlog files, unless you appreciate RANDOM CORRUPTION of your data.

He's talking about wiping out the ones on the backup server, so I think
Johannes means erasing the old archived logs on the secondary here.  That
can screw up your backup if you do it wrong, but it's not an all-caps
worthy mistake.

On Wed, 13 Jun 2007, Johannes Konert wrote:
> Because I do not want to rely on creation-date,

No, you want to rely on creation date, because then this problem goes
away.  The idea you should be working toward is that you identify when
your last base backup was started after it's copied to the secondary, and
then you can safely delete any archived logs file on the secondary from
before that time.  Instead of doing "ls | sort -g -r" you should be doing
something like looping over the files in a bash shell script and using
[ -ot <first xlog in base backup> ] to determine which files to delete.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: pg_xlog - files are guaranteed to be sequentialy named?
Next
From: Greg Smith
Date:
Subject: Re: pointer to feature comparisons, please