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

Add recovery_target='immediate' option.

This allows ending recovery as a consistent state has been reached. Without
this, there was no easy way to e.g restore an online backup, without
replaying any extra WAL after the backup ended.

MauMau and me.
This commit is contained in:
Heikki Linnakangas
2014-01-25 17:34:04 +02:00
parent 820f08cabd
commit 71c6a8e375
5 changed files with 86 additions and 15 deletions

View File

@ -1124,7 +1124,7 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
<para>
If you want to recover to some previous point in time (say, right before
the junior DBA dropped your main transaction table), just specify the
required stopping point in <filename>recovery.conf</>. You can specify
required <link linkend="recovery-target-settings">stopping point</link> in <filename>recovery.conf</>. You can specify
the stop point, known as the <quote>recovery target</>, either by
date/time, named restore point or by completion of a specific transaction
ID. As of this writing only the date/time and named restore point options

View File

@ -199,8 +199,33 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
<sect1 id="recovery-target-settings">
<title>Recovery Target Settings</title>
<para>
By default, recovery will recover to the end of the WAL log. The
following parameters can be used to specify an earlier stopping point.
At most one of <varname>recovery_target</>,
<varname>recovery_target_name</>, <varname>recovery_target_time</>, or
<varname>recovery_target_xid</> can be specified.
</para>
<variablelist>
<varlistentry id="recovery-target" xreflabel="recovery_target_name">
<term><varname>recovery_target</varname><literal> = 'immediate'</literal></term>
<indexterm>
<primary><varname>recovery_target</> recovery parameter</primary>
</indexterm>
<listitem>
<para>
This parameter specifies that recovery should end as soon as a
consistency is reached, ie. as early as possible. When restoring from an
online backup, this means the point where taking the backup ended.
</para>
<para>
Technically, this is a string parameter, but <literal>'immediate'</>
is currently the only allowed value.
</para>
</listitem>
</varlistentry>
<varlistentry id="recovery-target-name" xreflabel="recovery_target_name">
<term><varname>recovery_target_name</varname>
(<type>string</type>)
@ -212,10 +237,6 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
<para>
This parameter specifies the named restore point, created with
<function>pg_create_restore_point()</> to which recovery will proceed.
At most one of <varname>recovery_target_name</>,
<xref linkend="recovery-target-time"> or
<xref linkend="recovery-target-xid"> can be specified. The default is to
recover to the end of the WAL log.
</para>
</listitem>
</varlistentry>
@ -231,10 +252,6 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
<para>
This parameter specifies the time stamp up to which recovery
will proceed.
At most one of <varname>recovery_target_time</>,
<xref linkend="recovery-target-name"> or
<xref linkend="recovery-target-xid"> can be specified.
The default is to recover to the end of the WAL log.
The precise stopping point is also influenced by
<xref linkend="recovery-target-inclusive">.
</para>
@ -254,15 +271,18 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
start, transactions can complete in a different numeric order.
The transactions that will be recovered are those that committed
before (and optionally including) the specified one.
At most one of <varname>recovery_target_xid</>,
<xref linkend="recovery-target-name"> or
<xref linkend="recovery-target-time"> can be specified.
The default is to recover to the end of the WAL log.
The precise stopping point is also influenced by
<xref linkend="recovery-target-inclusive">.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
The following options further specify the recovery target, and affect
what happens when the target is reached:
</para>
<variablelist>
<varlistentry id="recovery-target-inclusive"
xreflabel="recovery_target_inclusive">