archive_cleanup_command.patch

application/octet-stream

Filename: archive_cleanup_command.patch
Type: application/octet-stream
Part: 0
Message: Re: Command to prune archive at restartpoints

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
doc/src/sgml/pgstandby.sgml 4 4
doc/src/sgml/recovery-config.sgml 4 4
doc/src/sgml/release-8.4.sgml 2 2
src/backend/access/transam/recovery.conf.sample 2 2
src/backend/access/transam/xlog.c 10 10
Index: doc/src/sgml/pgstandby.sgml
===================================================================
--- doc/src/sgml/pgstandby.sgml	(HEAD)
+++ doc/src/sgml/pgstandby.sgml	(archive_cleanup_command)
@@ -242,7 +242,7 @@
 
 restore_command = 'pg_standby -d -s 2 -t /tmp/pgsql.trigger.5442 .../archive %f %p %r 2>>standby.log'
 
-recovery_end_command = 'rm -f /tmp/pgsql.trigger.5442'
+archive_cleanup_command = 'rm -f /tmp/pgsql.trigger.5442'
   </programlisting>
   <para>
    where the archive directory is physically located on the standby server,
@@ -287,12 +287,12 @@
 
 restore_command = 'pg_standby -d -s 5 -t C:\pgsql.trigger.5442 ...\archive %f %p %r 2>>standby.log'
 
-recovery_end_command = 'del C:\pgsql.trigger.5442'
+archive_cleanup_command = 'del C:\pgsql.trigger.5442'
   </programlisting>
   <para>
    Note that backslashes need to be doubled in the
    <literal>archive_command</>, but <emphasis>not</emphasis> in the
-   <literal>restore_command</> or <literal>recovery_end_command</>.
+   <literal>restore_command</> or <literal>archive_cleanup_command</>.
    This will:
   </para>
   <itemizedlist>
@@ -363,7 +363,7 @@
   </para>
   <para>
    <productname>PostgreSQL</> 8.4 provides the
-   <literal>recovery_end_command</literal> option.  Without this option
+   <literal>archive_cleanup_command</literal> option.  Without this option
    a leftover trigger file can be hazardous.
   </para>
  </sect2>
Index: doc/src/sgml/recovery-config.sgml
===================================================================
--- doc/src/sgml/recovery-config.sgml	(HEAD)
+++ doc/src/sgml/recovery-config.sgml	(archive_cleanup_command)
@@ -102,16 +102,16 @@
       </listitem>
      </varlistentry>
 
-     <varlistentry id="recovery-end-command" xreflabel="recovery_end_command">
-      <term><varname>recovery_end_command</varname> (<type>string</type>)</term>
+     <varlistentry id="archive-cleanup-command" xreflabel="archive_cleanup_command">
+      <term><varname>archive_cleanup_command</varname> (<type>string</type>)</term>
       <indexterm>
-        <primary><varname>recovery_end_command</> recovery parameter</primary>
+        <primary><varname>archive_cleanup_command</> recovery parameter</primary>
       </indexterm>
       <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</> is to provide a mechanism for cleanup
+        <varname>archive_cleanup_command</> is to provide a mechanism for cleanup
         following replication or recovery.
         Any <literal>%r</> is replaced by the name of the file containing the
         last valid restart point, like in <xref linkend="restartpoint-command">.
Index: doc/src/sgml/release-8.4.sgml
===================================================================
--- doc/src/sgml/release-8.4.sgml	(HEAD)
+++ doc/src/sgml/release-8.4.sgml	(archive_cleanup_command)
@@ -157,7 +157,7 @@
     <listitem>
      <para>
       Fix erroneous handling of <literal>%r</> parameter in
-      <varname>recovery_end_command</> (Heikki)
+      <varname>archive_cleanup_command</> (Heikki)
      </para>
 
      <para>
@@ -4974,7 +4974,7 @@
 
       <para>
        To make this work safely, you now need to set the new
-       <literal>recovery_end_command</> option in <filename>recovery.conf</>
+       <literal>archive_cleanup_command</> option in <filename>recovery.conf</>
        to clean up the trigger file after failover. <application>pg_standby</>
        will no longer remove the trigger file itself.
       </para>
Index: src/backend/access/transam/recovery.conf.sample
===================================================================
--- src/backend/access/transam/recovery.conf.sample	(HEAD)
+++ src/backend/access/transam/recovery.conf.sample	(archive_cleanup_command)
@@ -53,12 +53,12 @@
 #
 #restartpoint_command = ''
 #
-# recovery_end_command
+# archive_cleanup_command
 #
 # specifies an optional shell command to execute at completion of recovery.
 # This can be useful for cleaning up after the restore_command.
 #
-#recovery_end_command = ''
+#archive_cleanup_command = ''
 #
 #---------------------------------------------------------------------------
 # RECOVERY TARGET PARAMETERS
Index: src/backend/access/transam/xlog.c
===================================================================
--- src/backend/access/transam/xlog.c	(HEAD)
+++ src/backend/access/transam/xlog.c	(archive_cleanup_command)
@@ -179,7 +179,7 @@
 
 /* options taken from recovery.conf for archive recovery */
 static char *recoveryRestoreCommand = NULL;
-static char *recoveryEndCommand = NULL;
+static char *archiveCleanupCommand = NULL;
 static char *restartPointCommand = NULL;
 static RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET;
 static bool recoveryTargetInclusive = true;
@@ -3135,7 +3135,7 @@
 
 		/*
 		 * translator: First %s represents a recovery.conf parameter name like
-		 * "recovery_end_command", and the 2nd is the value of that parameter.
+		 * "archive_cleanup_command", and the 2nd is the value of that parameter.
 		 */
 		ereport((signaled && failOnSignal) ? FATAL : WARNING,
 				(errmsg("%s \"%s\": return code %d", commandName,
@@ -5117,12 +5117,12 @@
 					(errmsg("restore_command = '%s'",
 							recoveryRestoreCommand)));
 		}
-		else if (strcmp(tok1, "recovery_end_command") == 0)
+		else if (strcmp(tok1, "archive_cleanup_command") == 0)
 		{
-			recoveryEndCommand = pstrdup(tok2);
+			archiveCleanupCommand = pstrdup(tok2);
 			ereport(DEBUG2,
-					(errmsg("recovery_end_command = '%s'",
-							recoveryEndCommand)));
+					(errmsg("archive_cleanup_command = '%s'",
+							archiveCleanupCommand)));
 		}
 		else if (strcmp(tok1, "restartpoint_command") == 0)
 		{
@@ -6385,11 +6385,11 @@
 			CreateCheckPoint(CHECKPOINT_END_OF_RECOVERY | CHECKPOINT_IMMEDIATE);
 
 		/*
-		 * And finally, execute the recovery_end_command, if any.
+		 * And finally, execute the archive_cleanup_command, if any.
 		 */
-		if (recoveryEndCommand)
-			ExecuteRecoveryCommand(recoveryEndCommand,
-								   "recovery_end_command",
+		if (archiveCleanupCommand)
+			ExecuteRecoveryCommand(archiveCleanupCommand,
+								   "archive_cleanup_command",
 								   true);
 	}