Re: archive_command - Mailing list pgsql-admin

From Simon Riggs
Subject Re: archive_command
Date
Msg-id 1128246295.3717.76.camel@localhost.localdomain
Whole thread Raw
In response to Re: archive_command  (Jeff Frost <jeff@frostconsultingllc.com>)
Responses Re: archive_command  (Jeff Frost <jeff@frostconsultingllc.com>)
List pgsql-admin
On Sat, 2005-10-01 at 21:43 -0700, Jeff Frost wrote:
> On Fri, 30 Sep 2005, Simon Riggs wrote:
>
> > If I follow your example, yes. But that assumes there is only one
> > timeline's WAL files in your pg_xlog. It could get more complex in that
> > situation because you could be in any of the timelines.
> >
> > But, if you know which timeline you're in, then yes, the file after the
> > latest file in archive_status is the current WAl file.
> >
> > It might be interesting to submit your script to put into contrib?
>
> So, actually, my script is probably doing things incorrectly at the moment.
> What effect would the different timelines create?  In my client's case there
> is only one timeline, but I'd love to generalize the script so we can put it
> in contrib, but first I'd like to make sure it actually works properly. :-)

The initial 000....0001 prefix of the WAL filename is the timeline
number.

If you recover the database from backup, specifying a target before the
end of WAL (with recovery_target_time or recovery_target_xid), then you
will generate a new timeline. If you then recover the database *again*
but this time specify a recovery_target_timeline less than the highest,
*but* this time *don't* specify a recovery_target_time or
recovery_target_xid then you'll end up with the current timeline being
less than the highest timeline number. (All of that seeming complexity
is absolutely necessary when you are trying to save your business data
from the skip. Thank Tom for having the insight to create it.)

It's possible that you would have files of the higher timeline numbers
still in the directory, that might confuse your program.

Probably the best idea is to backup the last WAL file for each timeline
seen. Keep track of that, so when the current file changes you'll know
which timeline you're on and stick to that from then on. Or more simply,
put some notes with your program saying "if you ever use a complex
recovery situation, make sure to clear all archive_status files for
higher timeline ids before using this program".

This would not be necessary had I completed my logswitch patch in time
for 8.1 freeze, but I regret that I was unable to do that.

Best Regards, Simon Riggs




pgsql-admin by date:

Previous
From: Jeff Frost
Date:
Subject: Re: archive_command
Next
From: "Robert Ngo"
Date:
Subject: backup software for postgresql