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-06 16:26:22
Message-ID: 4A01BA2E.8050505@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Mikael Krantz wrote:
> If you perform a recovery form a file system level backup postgres will
> switch to a new timeline but the first WAL-log in with the new timeline will
> contain the previous timeline.
>
> If you start a backup immediately after recovery have completed the start of
> the backup will be in this bad WAL file. This makes the backup unrecoverable
> as it will fail with an error similar to:
>
> LOG: unexpected timeline ID 54 in log file 4, segment 236, offset 0
> LOG: invalid checkpoint record
> PANIC: could not locate required checkpoint record
> HINT: If you are not restoring from a backup, try removing the file
> "/var/lib/postgresql/8.3/main/backup_label".
>
>
> 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.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stefan Huehner 2009-05-06 16:46:44 Re: Bug (8.4beta): FailedAssertion("!(bms_is_subset(relids, qualscope))", File: "initsplan.c", Line: 915)
Previous Message Tom Lane 2009-05-06 14:33:11 Re: Bug (8.4beta): FailedAssertion("!(bms_is_subset(relids, qualscope))", File: "initsplan.c", Line: 915)

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2009-05-06 16:32:17 Re: conditional dropping of columns/constraints
Previous Message Tom Lane 2009-05-06 16:18:42 Re: text_pattern_ops and complex regexps