pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndquadrant.com>
To: Jeff Frost <jeff@frostconsultingllc.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: archive_command
Date: Sun, 02 Oct 2005 10:44:55 +0100
Message-ID: <1128246295.3717.76.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.63.0510012142210.13614@discord.dyndns.org>
References: <20031115132118.V74587@holywar.net>
	<433AC059.1050300@musicrebellion.com>
	<Pine.LNX.4.63.0509280925070.28080@discord.dyndns.org>
	<433ACE02.3040208@musicrebellion.com>
	<1128071627.19345.256.camel@localhost.localdomain>
	<Pine.LNX.4.63.0509300926340.1280@discord.dyndns.org>
	<1128113968.4045.32.camel@localhost.localdomain>
	<Pine.LNX.4.63.0510012142210.13614@discord.dyndns.org>

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






view thread (17+ messages)  latest in thread

Message-ID: <1128246295.3717.76.camel@localhost.localdomain>
Permalink:  ../1128246295.3717.76.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1128246295.3717.76.camel@localhost.localdomain

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: simon@2ndquadrant.com, jeff@frostconsultingllc.com
  Subject: Re: archive_command
  In-Reply-To: <1128246295.3717.76.camel@localhost.localdomain>
  References: <20031115132118.V74587@holywar.net> <433AC059.1050300@musicrebellion.com> <Pine.LNX.4.63.0509280925070.28080@discord.dyndns.org> <433ACE02.3040208@musicrebellion.com> <1128071627.19345.256.camel@localhost.localdomain> <Pine.LNX.4.63.0509300926340.1280@discord.dyndns.org> <1128113968.4045.32.camel@localhost.localdomain> <Pine.LNX.4.63.0510012142210.13614@discord.dyndns.org> <1128246295.3717.76.camel@localhost.localdomain>

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

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