pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Point in Time Recovery
Date: Wed, 14 Jul 2004 00:54:05 +0100
Message-ID: <1089762845.17493.3417.camel@stromboli> (raw)
In-Reply-To: <20205.1089761301@sss.pgh.pa.us>
References: <200407132301.i6DN1fb16205@candle.pha.pa.us>
	<20205.1089761301@sss.pgh.pa.us>

On Wed, 2004-07-14 at 00:28, Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > OK, but procedurally, how do you correlate the start/stop time of the
> > tar backup with the WAL numeric file names?
> 
> Ideally the procedure for making a backup would go something like:
> 
> 1. Inquire of the server its current time and the WAL position of the
> most recent checkpoint record (which is what you really need).
> 
> 2. Make the backup.
> 
> 3. Inquire of the server its current time and the current end-of-WAL
> position.
> 
> 4. Record items 1 and 3 along with the backup itself.
> 
> I think the current theory was you could fake #1 by copying pg_control
> before everything else, but this doesn't really help for step #3, so
> it would probably be better to add some server functions to get this
> info.
> 

err...I think at this point we should review the PITR patch....

The recovery mechanism doesn't rely upon you knowing 1 or 3. The
recovery reads pg_control (from the backup) and then attempts to
de-archive the appropriate xlog segment file and then starts rollforward
from there. Effectively, restore assumes it has access to an infinite
timeline of logs....which clearly isn't the case, but its up to *you* to
check that you have the logs that go with the backups. (Or put another
way, if this sounds hard, buy some software that administers the
procedure for you). That's the mechanism that allows "infinite
recovery".

In brief, the code path is as identical as possible to the current crash
recovery situation...archive recovery restores the files from archive
when they are needed, just as if they had always been in pg_xlog, in a
way that ensures pg_xlog never runs out of space.

Recovery ends when: it reaches the recovery target you specified, or it
runs out of xlogs (first it runs out of archived xlogs, then tries to
find a more recent local copy if there is one).

I think the current theory was you could fake #1 by copying pg_control
> before everything else, but this doesn't really help for step #3, so
> it would probably be better to add some server functions to get this
> info.

Not sure what you mean by "fake"....

Best Regards, Simon Riggs




view thread (111+ messages)  latest in thread

Message-ID: <1089762845.17493.3417.camel@stromboli>
Permalink:  ../1089762845.17493.3417.camel@stromboli/
Also on:    postgresql.org/message-id/1089762845.17493.3417.camel@stromboli

 · 

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: pgsql-admin@postgresql.org
  Cc: simon@2ndquadrant.com, tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: Point in Time Recovery
  In-Reply-To: <1089762845.17493.3417.camel@stromboli>

* 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