1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add option to include WAL in base backup

When included, this makes the base backup a complete working
"clone" of the initial database, ready to have a postmaster
started against it without the need to set up any log archiving
or similar.

Magnus Hagander, reviewed by Fujii Masao and Heikki Linnakangas
This commit is contained in:
Magnus Hagander
2011-01-30 21:30:09 +01:00
parent 5d5678d7c3
commit 507069de6d
8 changed files with 197 additions and 44 deletions

View File

@ -1460,7 +1460,7 @@ The commands accepted in walsender mode are:
</varlistentry>
<varlistentry>
<term>BASE_BACKUP [<literal>LABEL</literal> <replaceable>'label'</replaceable>] [<literal>PROGRESS</literal>] [<literal>FAST</literal>]</term>
<term>BASE_BACKUP [<literal>LABEL</literal> <replaceable>'label'</replaceable>] [<literal>PROGRESS</literal>] [<literal>FAST</literal>] [<literal>WAL</literal>]</term>
<listitem>
<para>
Instructs the server to start streaming a base backup.
@ -1505,6 +1505,18 @@ The commands accepted in walsender mode are:
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>WAL</literal></term>
<listitem>
<para>
Include the necessary WAL segments in the backup. This will include
all the files between start and stop backup in the
<filename>pg_xlog</filename> directory of the base directory tar
file.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
@ -1561,7 +1573,10 @@ The commands accepted in walsender mode are:
</listitem>
<listitem>
<para>
<filename>pg_xlog</> (including subdirectories)
<filename>pg_xlog</>, including subdirectories. If the backup is run
with wal files included, a synthesized version of pg_xlog will be
included, but it will only contain the files necessary for the
backup to work, not the rest of the contents.
</para>
</listitem>
</itemizedlist>

View File

@ -144,6 +144,31 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>-x</option></term>
<term><option>--xlog</option></term>
<listitem>
<para>
Includes the required transaction log files (WAL files) in the
backup. This will include all transaction logs generated during
the backup. If this option is specified, it is possible to start
a postmaster directly in the extracted directory without the need
to consult the log archive, thus making this a completely standalone
backup.
</para>
<note>
<para>
The transaction log files are collected at the end of the backup.
Therefore, it is necessary for the
<xref linkend="guc-wal-keep-segments"> parameter to be set high
enough that the log is not removed before the end of the backup.
If the log has been rotated when it's time to transfer it, the
backup will fail and be unusable.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-Z <replaceable class="parameter">level</replaceable></option></term>
<term><option>--compress=<replaceable class="parameter">level</replaceable></option></term>
@ -164,7 +189,7 @@ PostgreSQL documentation
<variablelist>
<varlistentry>
<term><option>-c <replaceable class="parameter">fast|spread</replaceable></option></term>
<term><option>--checkpoint <replaceable class="parameter">fast|spread</replaceable></option></term>
<term><option>--checkpoint=<replaceable class="parameter">fast|spread</replaceable></option></term>
<listitem>
<para>
Sets checkpoint mode to fast or spread (default).
@ -191,7 +216,10 @@ PostgreSQL documentation
Enables progress reporting. Turning this on will deliver an approximate
progress report during the backup. Since the database may change during
the backup, this is only an approximation and may not end at exactly
<literal>100%</literal>.
<literal>100%</literal>. In particular, when WAL log is included in the
backup, the total amount of data cannot be estimated in advance, and
in this case the progress report will only count towards the total
amount of data without WAL.
</para>
<para>
When this is enabled, the backup will start by enumerating the size of