On Sun, 2018-11-25 at 16:04 -0500, Stephen Frost wrote:
> > > There isn’t any need to write the backup label before you restore the database,
> > > just as you write recovery.conf then.
> >
> > Granted.
> > But it is pretty convenient, and writing it to the data directory right away
> > is a good thing on top, because it reduces the danger of inadvertedly
> > starting the backup without recovery.
>
> Writing it into the data directory is *not* a good thing because as soon as you do
> that you risk there being an issue if there’s a crash. Writing into the backup
> isn’t a bad idea but if you’re managing your backups then writing it somewhere else
> (such as where you write your WAL) and associating it with the backup (presumably
> it has a label) should make it easy to pull back when you restore.
If there is a crash during the backup procedure, the backup is bad.
Doesn't matter during which part of the backup procedure it happens.
> > Yes, you can come up with a post-backup script that somehow communicates
> > with your pre-backup script to get the information, but it sure is
> > inconvenient. Simplicity is good in backup solutions, because complicated
> > things tend to break more easily.
>
> Not sure what communication is necessary here..? The data needed for the backup
> label file comes from pg_stop_backup in a non-exclusive backup.
Right, and pg_stop_backup has to be run from the "pre-backup" script.
Yours,
Laurenz Albe