Re: backup_label and server start - Mailing list pgsql-hackers

From Peter Childs
Subject Re: backup_label and server start
Date
Msg-id a2de01dd0711210147r7ba662e9l861e785129ef757e@mail.gmail.com
Whole thread Raw
In response to Re: backup_label and server start  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: backup_label and server start  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers


On 21/11/2007, Simon Riggs <simon@2ndquadrant.com> wrote:
On Wed, 2007-11-21 at 09:04 +0100, Albe Laurenz wrote:

> If somebody stops the postmaster while an online backup is
> in progress, there is no warning or nothing. Only the server
> will fail to restart.

Well, it seems best not to do this. There is always a need for a careful
procedure to manually shutdown a live server, interlocking with other
applications. ISTM like a manual procedure will resolve this for you.

If we remove the file in the place you suggest then an Archive Recovery
will succeed when it should fail, with no possibility of a hint, which
seems a worse error.

> All I want to do is restart a server after a clean shutdown.
>
> How about my second suggestion:
>
> Remove backup_label when the server shuts down cleanly.
> In that case an online backup in progress will not be useful
> anyway, and there is no need to recover on server restart.

That will make PITRs fail:

1. pg_start_backup()
2. backup
3. shutdown, removes backup_label
4. pg_stop_backup()

step 4 will now fail because of a missing backup_label file.


How about this, emit a warning on shutdown and fail to shutdown until the backup has finished. 

Seams to me that either way your sunk if you shut down a server while a backup is in progress.  Your only way out is to work out weather to use the previous pitr backups plus logs or remove the label. Doing it automatically would be very very dangerous.

Peter.

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: backup_label and server start
Next
From: Alvaro Herrera
Date:
Subject: Re: plperl failure on OS X 10.5(.1)