On Mon, 2005-04-18 at 00:20 -0400, Bruce Momjian wrote:
> Jeff Davis wrote:
> >
> > Can you sort of run through the failure case again, and how to prevent
> > it?
>
> The failure case in the original docs is that you do your
> pg_stop_backup(), and then delete all the WAL file before the *.backup
> file that was just created. However, you do not have a valid tar backup
> until you have archived all the WAL files used from the *.backup WAL
> file up to the WAL file that was active at pg_stop_backup(), which is
> mentioned in the *.backup file. If you went and deleted your old WAL
> files anyway, without waiting for those other WAL files to be archived,
> and your disk drive crashed, you wouldn't have a tar backup you could
> use, and you had deleted the old WAL files you would have needed to
> recover your previous tar backup.
>
> Is there something in the current wording that needs clarification?
>
So, as I understand it: everything works great as long as everything has
been archived up to and including the WAL file that was active when you
did pg_stop_backup(). However, if you do pg_stop_backup() and
immediately delete PGDATA (before any WAL files are archived), the
backup may fail.
I think, to clear it up a little, you might add a step 5 before saying
"If this returns successfully, you're done.", so that people know for
sure that they get a good base backup. It actually seems like something
that maybe pg_stop_backup() should do in the future.
It's a little unclear how you tell which WAL segment was active during
pg_stop_backup(), but that shouldn't be a practical concern since you
can just manually archive them all.
Maybe step 5 could be something like:
(5) Make a copy of all WAL segments above XXXX.backup and store with the
base backup. When it's time to recover, if those WAL segments were not
properly archived, you need to have them available.
(probably needs rewording)
Regards,Jeff Davis