Skip site navigation (1) Skip section navigation (2)

Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Mikael Krantz <mk(at)zigamorph(dot)se>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file
Date: 2009-05-07 09:15:38
Message-ID: 4A02A6BA.1030306@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Mikael Krantz wrote:
> On Wed, May 6, 2009 at 6:26 PM, Heikki Linnakangas
> <heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>>> How to reproduce:
>>>
>>>  * restore from backup
>>>  * SELECT pg_start_backup('label');
>>>  * take a new backup
>>>  * SELECT pg_stop_backup();
>>>  * copy the relevant WAL-files
>>>  * try to restore the backup
>> I failed to reproduce this. Is it possible that the history file went
>> missing in the process? That's needed to recover WAL files from timelines
>> other than the latest one. You should only get that "unexpected timeline ID"
>> message if the history file doesn't contain a line for that timeline ID.
> 
> Yes that's true. The history file is not included in the backup. It is
> archived before the backup starts and is not included in the
> range specified in the backup file (e.g:
> 0000003B00000004000000FC.00000020.backup).
> 
> Doesn't this mean that the range of log-files in the backup file is
> incorrect? If the first WAL-file in the range contain records
> referring to earlier timelines I will have to backup the .history-file
> of that timeline in addition to the WAL-files explicitly required for
> the backup. Or force a switch of log-files before starting the backup
> as I'm currently doing.

Yeah, I think you're right. If you omit pg_xlog from the base backup, as 
we recommend in the manual, and clear the old files from the archive 
too, then you won't have the old history file around.

I'll make pg_start_backup() to request xlog switch before the checkpoint 
as you suggested. That's an easy fix that can be easily back-patched.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-hackers by date

Next:From: Laurent LabordeDate: 2009-05-07 09:25:15
Subject: Re: create if not exists (CINE)
Previous:From: Mikael KrantzDate: 2009-05-07 07:56:23
Subject: Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file

pgsql-bugs by date

Next:From: Heikki LinnakangasDate: 2009-05-07 11:34:53
Subject: Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file
Previous:From: Dave PageDate: 2009-05-07 08:30:48
Subject: Re: BUG #4785: Installation fails

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group