From 2a1cf97c22933368c8747711da0f30c35f4bddcd Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 5 Apr 2008 01:34:06 +0000 Subject: Have pg_stop_backup() wait for all archive files to be sent, rather than returing right away. This guarantees that when pg_stop_backup() returns, you have a valid backup. Simon Riggs --- doc/src/sgml/backup.sgml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index 9f369f8e6d1..2697edf86e3 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -1,4 +1,4 @@ - + Backup and Restore @@ -761,12 +761,19 @@ SELECT pg_stop_backup(); Once the WAL segment files used during the backup are archived, you are done. The file identified by pg_stop_backup's result is - the last segment that needs to be archived to complete the backup. - Archival of these files will happen automatically, since you have - already configured archive_command. In many cases, this - happens fairly quickly, but you are advised to monitor your archival - system to ensure this has taken place so that you can be certain you - have a complete backup. + the last segment that is required to form a complete set of backup files. + pg_stop_backup does not return until the last segment has + been archived. + Archiving of these files happens automatically since you have + already configured archive_command. In most cases this + happens quickly, but you are advised to monitor your archive + system to ensure there are no delays. + If the archive process has fallen behind + because of failures of the archive command, it will keep retrying + until the archive succeeds and the backup is complete. + If you wish to place a time limit on the execution of + pg_stop_backup, set an appropriate + statement_timeout value. @@ -1044,7 +1051,7 @@ restore_command = 'cp /mnt/server/archivedir/%f %p' The stop point must be after the ending time of the base backup, i.e., - the time of pg_stop_backup. You cannot use a base backup + the end time of pg_stop_backup. You cannot use a base backup to recover to a time when that backup was still going on. (To recover to such a time, you must go back to your previous base backup and roll forward from there.) @@ -1322,6 +1329,7 @@ tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ After the backup the switch file is removed. Archived WAL files are then added to the backup so that both base backup and all required WAL files are part of the same tar file. + Please remember to add error handling to your backup scripts. -- cgit v1.2.3