Re: pg_xlog - files are guaranteed to be sequentialy named?

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_xlog - files are guaranteed to be sequentialy named?
Date: 2007-06-13 15:48:33
Message-ID: Pine.GSO.4.64.0706131132240.3220@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2007-06-13 16:06:47 Re: pointer to feature comparisons, please
Previous Message Scott Marlowe 2007-06-13 15:43:19 Re: pg_xlog - files are guaranteed to be sequentialy named?