mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
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
This commit is contained in:
@ -1012,10 +1012,15 @@ SELECT pg_start_backup('label', true);
|
||||
<programlisting>
|
||||
SELECT pg_stop_backup();
|
||||
</programlisting>
|
||||
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, <function>pg_switch_wal</function> should be executed on
|
||||
the primary.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -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, <function>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 <varname>archive_mode = always</>.
|
||||
If write activity on the primary is low, it may be useful to run
|
||||
<function>pg_switch_wal</> on the primary in order to trigger
|
||||
an immediate segment switch.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user