From 52f8a59dd953c6820baf153e97cf07d31b8ac1d6 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Sat, 5 Aug 2017 10:49:26 -0400 Subject: Make pg_stop_backup's wait_for_archive flag work on standbys. Previously, it had no effect. Now, if archive_mode=always, it will work, and if not, you'll get a warning. Masahiko Sawada, Michael Paquier, and Robert Haas. The patch as submitted also changed the behavior so that we would write and remove history files on standbys, but that seems like material for a separate patch to me. Discussion: http://postgr.es/m/CAD21AoC2Xw6M=ZJyejq_9d_iDkReC_=rpvQRw5QsyzKQdfYpkw@mail.gmail.com --- doc/src/sgml/backup.sgml | 13 +++++++++---- doc/src/sgml/func.sgml | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index 7820de931cf..0e7c6e20511 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -1012,10 +1012,15 @@ SELECT pg_start_backup('label', true); SELECT pg_stop_backup(); - This terminates the backup mode and performs an automatic switch to - the next WAL segment. The reason for the switch is to arrange for - the last WAL segment file written during the backup interval to be - ready to archive. + This function, when called on a primary, terminates the backup mode and + performs an automatic switch to the next WAL segment. The reason for the + switch is to arrange for the last WAL segment written during the backup + interval to be ready to archive. When called on a standby, this function + only terminates backup mode. A subsequent WAL segment switch will be + needed in order to ensure that all WAL files needed to restore the backup + can be archived; if the primary does not have sufficient write activity + to trigger one, pg_switch_wal should be executed on + the primary. diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 36319222e6c..b43ec30a4e2 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -18597,7 +18597,12 @@ postgres=# select pg_start_backup('label_goes_here'); WAL to be archived. This behavior is only useful for backup software which independently monitors WAL archiving. Otherwise, WAL required to make the backup consistent might be missing and make the backup - useless. + useless. When this parameter is set to true, pg_stop_backup + will wait for WAL to be archived when archiving is enabled; on the standby, + this means that it will wait only when archive_mode = always. + If write activity on the primary is low, it may be useful to run + pg_switch_wal on the primary in order to trigger + an immediate segment switch. -- cgit v1.2.3