From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | laurenz(dot)albe(at)wien(dot)gv(dot)at ("Albe Laurenz"), "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Fujii Masao" <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: backup_label in a crash recovery |
Date: | 2009-11-03 15:01:15 |
Message-ID: | 873a4vfynl.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>>>> "Albe" == "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> writes:
Albe> Removing postmaster.pid can lead to a corrupt database.
Albe> Removing backup_label means that one of your backups will go
Albe> wrong, and a subsequent pg_stop_backup() will throw an error.
Albe> If you have a cluster failover during an online backup, I think
Albe> any reasonable person would suspect that the backup went wrong.
Albe> And if nothing else does, the error on pg_stop_backup() will
Albe> tell you.
[...]
Albe> Is there a flaw in my reasoning?
Yes.
Imagine the following scenario: the system crashed while pg_start_backup
was in effect (so backup_label exists), and the postmaster is about to
start up. i.e. you're at the point where you might naively imagine that
you can delete the backup_label.
How do you distinguish between these two scenarios:
1) you're starting up in a data dir where you crashed in the middle of
a backup
2) you're starting up in a data dir that is a restore of a base backup,
but no recovery.conf has been created
(hint: you can't)
If in scenario 2, you remove the backup_label and proceed with
recovery, there is a significant chance (depending on the timing, and
if you didn't exclude pg_xlog from the backup) that recovery will
_think_ it succeeds but actually leaves you with a corrupt data
directory.
--
Andrew (irc:RhodiumToad)
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2009-11-03 15:06:45 | Re: new version of PQconnectdb was:(Re: [HACKERS] Determining client_encoding from client locale) |
Previous Message | Andrew Dunstan | 2009-11-03 14:49:00 | Re: EOL for 7.4? |