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

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Mikael Krantz <mk(at)zigamorph(dot)se>, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file
Date: 2009-05-15 11:56:55
Message-ID: 4A0D5887.5050105@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Fujii Masao wrote:
> On Fri, May 15, 2009 at 8:20 PM, Heikki Linnakangas
> <heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>> The probe in findNewestTimeLine() initialized to recovery target timeline +
>> 1. It doesn't require history files for any old timelines to be present.
>
> What if recovery_target_timeline = 'latest'? The unexpected (not latest)
> recovery target timeline might be chosen when some timeline history
> files don't exist.
>
>> The
>> purpose of findNewestTimeLine() is to ensure that if you e.g recover to a
>> point in time in timeline 5, and there's already WAL files for timelines 6
>> and 7 in the archive, we pick a unique timeline id.
>
> When only the history file for timeline 6 is deleted, timeline 6 would be
> assigned as the newest one *again* at the end of archive recovery.
> Is this safe?

If you delete history file and all the WAL for timeline 6, yeah, nothing
stops it from being reused. It will work just fine, as if it never
existed. If you still have the history file and WAL for the old timeline
6 lying around somewhere else like an older offsite backup, it's easy
for the administrator to get confused, but there isn't much we can do
about that.

Simon's idea of keeping a copy of all the history files in the data
directory wouldn't help here. In fact, I think we already never delete
history files in the server, it's just that if you omit the pg_xlog
directory in the base backup they won't be included. But even if they
are included in the base backup, that wouldn't help in this scenario
because the base backup still wouldn't contain the history files for the
later timelines.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Simon Riggs 2009-05-15 11:58:34 Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file
Previous Message Simon Riggs 2009-05-15 11:56:33 Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-05-15 11:58:34 Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file
Previous Message Simon Riggs 2009-05-15 11:56:33 Re: [HACKERS] Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file