Home Explore Blog CI



postgresql

62th chunk of `doc/src/sgml/config.sgml`
5337579f8df68b0a4e9fca5aec7a2984c768d74d98adbf2c0000000100000fb1
  same archive directory, you will need to ensure that you do not delete
        WAL files until they are no longer needed by any of the servers.
        <varname>archive_cleanup_command</varname> would typically be used in a
        warm-standby configuration (see <xref linkend="warm-standby"/>).
        Write <literal>%%</literal> to embed an actual <literal>%</literal> character in the
        command.
       </para>
       <para>
        If the command returns a nonzero exit status then a warning log
        message will be written.  An exception is that if the command was
        terminated by a signal or an error by the shell (such as command not
        found), a fatal error will be raised.
       </para>
       <para>
        This parameter can only be set in the <filename>postgresql.conf</filename>
        file or on the server command line.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-recovery-end-command" xreflabel="recovery_end_command">
      <term><varname>recovery_end_command</varname> (<type>string</type>)
      <indexterm>
        <primary><varname>recovery_end_command</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        This parameter specifies a shell command that will be executed once only
        at the end of recovery. This parameter is optional. The purpose of the
        <varname>recovery_end_command</varname> is to provide a mechanism for cleanup
        following replication or recovery.
        Any <literal>%r</literal> is replaced by the name of the file containing the
        last valid restart point, like in <xref linkend="guc-archive-cleanup-command"/>.
       </para>
       <para>
        If the command returns a nonzero exit status then a warning log
        message will be written and the database will proceed to start up
        anyway.  An exception is that if the command was terminated by a
        signal or an error by the shell (such as command not found), the
        database will not proceed with startup.
       </para>
       <para>
        This parameter can only be set in the <filename>postgresql.conf</filename>
        file or on the server command line.
       </para>
      </listitem>
     </varlistentry>

    </variablelist>

  </sect2>

  <sect2 id="runtime-config-wal-recovery-target">

    <title>Recovery Target</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>,
      <varname>recovery_target_lsn</varname>, <varname>recovery_target_name</varname>,
      <varname>recovery_target_time</varname>, or <varname>recovery_target_xid</varname>
      can be used; if more than one of these is specified in the configuration
      file, an error will be raised.
      These parameters can only be set at server start.
     </para>

     <variablelist>
     <varlistentry id="guc-recovery-target" xreflabel="recovery_target">
      <term><varname>recovery_target</varname><literal> = 'immediate'</literal>
      <indexterm>
        <primary><varname>recovery_target</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        This parameter specifies that recovery should end as soon as a
        consistent state is reached, i.e., 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'</literal>
        is currently the only allowed value.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-recovery-target-name" xreflabel="recovery_target_name">
      <term><varname>recovery_target_name</varname> (<type>string</type>)
      <indexterm>
        <primary><varname>recovery_target_name</varname>

Title: recovery_end_command and Recovery Target Details
Summary
This section describes the `recovery_end_command` and various recovery target parameters. `recovery_end_command` specifies a shell command executed once at the end of recovery for cleanup purposes, using the last valid restart point. A nonzero exit status results in a warning, while termination by a signal or shell error prevents database startup. The recovery target parameters allow specifying a stopping point for recovery earlier than the end of the WAL log. Options include `recovery_target` (recovering to a consistent state as early as possible), and `recovery_target_name`.