From 756daf723fb57c565e39c02dda235514e3bb7577 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Thu, 21 Jul 2016 15:43:15 +0900
Subject: [PATCH 2/2] Fix documentation about pg_stop_backup.

In the description about continuous archiving, pg_stop_backup is
wrongly described. This fixes that. Addition to that, adding a mention
on what happens if pg_control is not backup last.
---
 doc/src/sgml/backup.sgml | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 0f09d82..c4c182d 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -894,20 +894,27 @@ SELECT * FROM pg_stop_backup(false);
      ready to archive.
     </para>
     <para>
-     The <function>pg_stop_backup</> will return one row with three
-     values. The second of these fields should be written to a file named
-     <filename>backup_label</> in the root directory of the backup. The
-     third field should be written to a file named
-     <filename>tablespace_map</> unless the field is empty. These files are
-     vital to the backup working, and must be written without modification.
+     The <function>pg_stop_backup</> will return the LSN when it is called.
+     This LSN informs upto where the backup needs WAL segment files to
+     complete. For a backup taken from a master, this function leaves a backup
+     history file to inform the segment files needed and a server starts from
+     the backup performes a recovery up to where a backup-end WAL record to
+     reach a consistent state. But things are different for a backup taken
+     from a standby. For the case, backup history file won't be created and
+     recvoery is perfomed up to the Minimum-recovery-ending-location field in
+     the pg_control file included in the backup instead. The location is
+     properly stored in the backup if you copy the the pg_control file after
+     all the other files as pg_basebackup does. Note that a hot standby
+     started from a backup not taken in that manner will consider to have
+     reached a consistent state mistakenly earlier.
     </para>
    </listitem>
    <listitem>
     <para>
      Once the WAL segment files active during the backup are archived, you are
-     done.  The file identified by <function>pg_stop_backup</>'s first return
-     value is the last segment that is required to form a complete set of
-     backup files.  If <varname>archive_mode</> is enabled,
+     done.  The file contains the LSN returned by <function>pg_stop_backup</>
+     is the last segment that is required to form a complete set of backup
+     files.  If <varname>archive_mode</> is enabled,
      <function>pg_stop_backup</> does not return until the last segment has
      been archived.
      Archiving of these files happens automatically since you have
-- 
1.8.3.1

