Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b1d485

Browse files
committed
Improve low-level backup documentation.
Our documentation hasn't really caught up with the fact thatnon-exclusive backups can now be taken using pg_start_backup andpg_stop_backup even on standbys. Update.David Steele, reviewed by Robert Haas and Michael PaquierDiscussion:http://postgr.es/m/f349b834-1443-ebf0-3c2a-965f944004d7@pgmasters.net
1 parent941e47f commit9b1d485

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

‎doc/src/sgml/backup.sgml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,11 @@ SELECT pg_start_backup('label', false, false);
889889
<programlisting>
890890
SELECT * FROM pg_stop_backup(false);
891891
</programlisting>
892-
This terminates the backup mode and performs an automatic switch to
893-
the next WAL segment. The reason for the switch is to arrange for
892+
This terminates backup mode. On a primary, it also performs an automatic
893+
switch to the next WAL segment. On a standby, it is not possible to
894+
automatically switch WAL segments, so you may wish to run
895+
<function>pg_switch_xlog</function> on the primary to perform a manual
896+
switch. The reason for the switch is to arrange for
894897
the last WAL segment file written during the backup interval to be
895898
ready to archive.
896899
</para>
@@ -908,7 +911,7 @@ SELECT * FROM pg_stop_backup(false);
908911
Once the WAL segment files active during the backup are archived, you are
909912
done. The file identified by <function>pg_stop_backup</>'s first return
910913
value is the last segment that is required to form a complete set of
911-
backup files.If <varname>archive_mode</> is enabled,
914+
backup files.On a primary, if <varname>archive_mode</> is enabled,
912915
<function>pg_stop_backup</> does not return until the last segment has
913916
been archived.
914917
Archiving of these files happens automatically since you have
@@ -924,6 +927,13 @@ SELECT * FROM pg_stop_backup(false);
924927
<function>pg_stop_backup</> terminates because of this your backup
925928
may not be valid.
926929
</para>
930+
931+
<para>
932+
Note that on a standby <function>pg_stop_backup</> does not wait for
933+
WAL segments to be archived so the backup process must ensure that all WAL
934+
segments required for the backup are successfully archived.
935+
</para>
936+
927937
</listitem>
928938
</orderedlist>
929939
</para>
@@ -932,9 +942,9 @@ SELECT * FROM pg_stop_backup(false);
932942
<title>Making an exclusive low level backup</title>
933943
<para>
934944
The process for an exclusive backup is mostly the same as for a
935-
non-exclusive one, but it differs in a few key steps.It does not allow
936-
more than one concurrent backup to run, andthere can be some issues on
937-
the server if it crashes during the backup.Prior to PostgreSQL 9.6, this
945+
non-exclusive one, but it differs in a few key steps.This type of backup
946+
can only be taken on a primary anddoes not allow concurrent backups.
947+
Prior to<productname>PostgreSQL</> 9.6, this
938948
was the only low-level method available, but it is now recommended that
939949
all users upgrade their scripts to use non-exclusive backups if possible.
940950
</para>
@@ -992,6 +1002,11 @@ SELECT pg_start_backup('label', true);
9921002
<xref linkend="backup-lowlevel-base-backup-data"> for things to
9931003
consider during this backup.
9941004
</para>
1005+
<para>
1006+
Note that if the server crashes during the backup it may not be
1007+
possible to restart until the <literal>backup_label</> file has been
1008+
manually deleted from the <envar>PGDATA</envar> directory.
1009+
</para>
9951010
</listitem>
9961011
<listitem>
9971012
<para>

‎doc/src/sgml/func.sgml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18070,11 +18070,22 @@ postgres=# select pg_start_backup('label_goes_here');
1807018070
<function>pg_start_backup</>. In a non-exclusive backup, the contents of
1807118071
the <filename>backup_label</> and <filename>tablespace_map</> are returned
1807218072
in the result of the function, and should be written to files in the
18073-
backup (and not in the data directory).
18073+
backup (and not in the data directory). When executed on a primary
18074+
<function>pg_stop_backup</> will wait for WAL to be archived, provided that
18075+
archiving is enabled.
1807418076
</para>
1807518077

1807618078
<para>
18077-
The function also creates a backup history file in the transaction log
18079+
On a standby <function>pg_stop_backup</> will return immediately without
18080+
waiting, so it's important to verify that all required WAL segments have
18081+
been archived. If write activity on the primary is low, it may be useful
18082+
to run <function>pg_switch_xlog</> on the primary in order to trigger a
18083+
segment switch.
18084+
</para>
18085+
18086+
<para>
18087+
When executed on a primary, the function also creates a backup history file
18088+
in the write-ahead log
1807818089
archive area. The history file includes the label given to
1807918090
<function>pg_start_backup</>, the starting and ending transaction log locations for
1808018091
the backup, and the starting and ending times of the backup. The return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp