mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Rename restartpoint_command to archive_cleanup_command.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/high-availability.sgml,v 1.71 2010/06/07 02:01:08 itagaki Exp $ -->
 | 
					<!-- $PostgreSQL: pgsql/doc/src/sgml/high-availability.sgml,v 1.72 2010/06/10 08:13:49 itagaki Exp $ -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<chapter id="high-availability">
 | 
					<chapter id="high-availability">
 | 
				
			||||||
 <title>High Availability, Load Balancing, and Replication</title>
 | 
					 <title>High Availability, Load Balancing, and Replication</title>
 | 
				
			||||||
@@ -681,7 +681,7 @@ protocol to make nodes agree on a serializable transactional order.
 | 
				
			|||||||
   </para>
 | 
					   </para>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   <para>
 | 
					   <para>
 | 
				
			||||||
    You can use <varname>restartpoint_command</> to prune the archive of
 | 
					    You can use <varname>archive_cleanup_command</> to prune the archive of
 | 
				
			||||||
    files no longer needed by the standby.
 | 
					    files no longer needed by the standby.
 | 
				
			||||||
   </para>
 | 
					   </para>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -714,7 +714,7 @@ trigger_file = '/path/to/trigger_file'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   <para>
 | 
					   <para>
 | 
				
			||||||
    If you're using a WAL archive, its size can be minimized using
 | 
					    If you're using a WAL archive, its size can be minimized using
 | 
				
			||||||
    the <varname>restartpoint_command</> option to remove files that are
 | 
					    the <varname>archive_cleanup_command</> option to remove files that are
 | 
				
			||||||
    no longer required by the standby server. Note however, that if you're
 | 
					    no longer required by the standby server. Note however, that if you're
 | 
				
			||||||
    using the archive for backup purposes, you need to retain files needed
 | 
					    using the archive for backup purposes, you need to retain files needed
 | 
				
			||||||
    to recover from at least the latest base backup, even if they're no
 | 
					    to recover from at least the latest base backup, even if they're no
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/recovery-config.sgml,v 2.6 2010/04/28 07:34:11 heikki Exp $ -->
 | 
					<!-- $PostgreSQL: pgsql/doc/src/sgml/recovery-config.sgml,v 2.7 2010/06/10 08:13:49 itagaki Exp $ -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<chapter Id="recovery-config">
 | 
					<chapter Id="recovery-config">
 | 
				
			||||||
  <title>Recovery Configuration</title>
 | 
					  <title>Recovery Configuration</title>
 | 
				
			||||||
@@ -73,16 +73,16 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
 | 
				
			|||||||
      </listitem>
 | 
					      </listitem>
 | 
				
			||||||
     </varlistentry>
 | 
					     </varlistentry>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     <varlistentry id="restartpoint-command" xreflabel="restartpoint_command">
 | 
					     <varlistentry id="archive-cleanup-command" xreflabel="archive_cleanup_command">
 | 
				
			||||||
      <term><varname>restartpoint_command</varname> (<type>string</type>)</term>
 | 
					      <term><varname>archive_cleanup_command</varname> (<type>string</type>)</term>
 | 
				
			||||||
      <indexterm>
 | 
					      <indexterm>
 | 
				
			||||||
        <primary><varname>restartpoint_command</> recovery parameter</primary>
 | 
					        <primary><varname>archive_cleanup_command</> recovery parameter</primary>
 | 
				
			||||||
      </indexterm>
 | 
					      </indexterm>
 | 
				
			||||||
      <listitem>
 | 
					      <listitem>
 | 
				
			||||||
       <para>
 | 
					       <para>
 | 
				
			||||||
        This parameter specifies a shell command that will be executed at
 | 
					        This parameter specifies a shell command that will be executed at
 | 
				
			||||||
        every restartpoint. This parameter is optional. The purpose of the
 | 
					        every restartpoint. This parameter is optional. The purpose of the
 | 
				
			||||||
        <varname>restartpoint_command</> is to provide a mechanism for cleaning
 | 
					        <varname>archive_cleanup_command</> is to provide a mechanism for cleaning
 | 
				
			||||||
        up old archived WAL files that are no longer needed by the standby
 | 
					        up old archived WAL files that are no longer needed by the standby
 | 
				
			||||||
        server.
 | 
					        server.
 | 
				
			||||||
        Any <literal>%r</> is replaced by the name of the file
 | 
					        Any <literal>%r</> is replaced by the name of the file
 | 
				
			||||||
@@ -114,7 +114,7 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
 | 
				
			|||||||
        <varname>recovery_end_command</> is to provide a mechanism for cleanup
 | 
					        <varname>recovery_end_command</> is to provide a mechanism for cleanup
 | 
				
			||||||
        following replication or recovery.
 | 
					        following replication or recovery.
 | 
				
			||||||
        Any <literal>%r</> is replaced by the name of the file containing the
 | 
					        Any <literal>%r</> is replaced by the name of the file containing the
 | 
				
			||||||
        last valid restart point, like in <xref linkend="restartpoint-command">.
 | 
					        last valid restart point, like in <xref linkend="archive-cleanup-command">.
 | 
				
			||||||
       </para>
 | 
					       </para>
 | 
				
			||||||
       <para>
 | 
					       <para>
 | 
				
			||||||
        If the command returns a non-zero exit status then a WARNING log
 | 
					        If the command returns a non-zero exit status then a WARNING log
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,12 +46,12 @@
 | 
				
			|||||||
#restore_command = ''		# e.g. 'cp /mnt/server/archivedir/%f %p'
 | 
					#restore_command = ''		# e.g. 'cp /mnt/server/archivedir/%f %p'
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# restartpoint_command
 | 
					# archive_cleanup_command
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# specifies an optional shell command to execute at every restartpoint.
 | 
					# specifies an optional shell command to execute at every restartpoint.
 | 
				
			||||||
# This can be useful for cleaning up the archive of a standby server.
 | 
					# This can be useful for cleaning up the archive of a standby server.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#restartpoint_command = ''
 | 
					#archive_cleanup_command = ''
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# recovery_end_command
 | 
					# recovery_end_command
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@
 | 
				
			|||||||
 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
 | 
					 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
 | 
				
			||||||
 * Portions Copyright (c) 1994, Regents of the University of California
 | 
					 * Portions Copyright (c) 1994, Regents of the University of California
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.421 2010/06/10 07:49:23 heikki Exp $
 | 
					 * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.422 2010/06/10 08:13:50 itagaki Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *-------------------------------------------------------------------------
 | 
					 *-------------------------------------------------------------------------
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -180,7 +180,7 @@ static bool restoredFromArchive = false;
 | 
				
			|||||||
/* options taken from recovery.conf for archive recovery */
 | 
					/* options taken from recovery.conf for archive recovery */
 | 
				
			||||||
static char *recoveryRestoreCommand = NULL;
 | 
					static char *recoveryRestoreCommand = NULL;
 | 
				
			||||||
static char *recoveryEndCommand = NULL;
 | 
					static char *recoveryEndCommand = NULL;
 | 
				
			||||||
static char *restartPointCommand = NULL;
 | 
					static char *archiveCleanupCommand = NULL;
 | 
				
			||||||
static RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET;
 | 
					static RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET;
 | 
				
			||||||
static bool recoveryTargetInclusive = true;
 | 
					static bool recoveryTargetInclusive = true;
 | 
				
			||||||
static TransactionId recoveryTargetXid;
 | 
					static TransactionId recoveryTargetXid;
 | 
				
			||||||
@@ -382,10 +382,10 @@ typedef struct XLogCtlData
 | 
				
			|||||||
	TimeLineID	ThisTimeLineID;
 | 
						TimeLineID	ThisTimeLineID;
 | 
				
			||||||
	TimeLineID	RecoveryTargetTLI;
 | 
						TimeLineID	RecoveryTargetTLI;
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * restartPointCommand is read from recovery.conf but needs to be in
 | 
						 * archiveCleanupCommand is read from recovery.conf but needs to be in
 | 
				
			||||||
	 * shared memory so that the bgwriter process can access it.
 | 
						 * shared memory so that the bgwriter process can access it.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	char		restartPointCommand[MAXPGPATH];
 | 
						char		archiveCleanupCommand[MAXPGPATH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * SharedRecoveryInProgress indicates if we're still in crash or archive
 | 
						 * SharedRecoveryInProgress indicates if we're still in crash or archive
 | 
				
			||||||
@@ -3063,7 +3063,7 @@ not_available:
 | 
				
			|||||||
 * 'failonSignal' is true and the command is killed by a signal, a FATAL
 | 
					 * 'failonSignal' is true and the command is killed by a signal, a FATAL
 | 
				
			||||||
 * error is thrown. Otherwise a WARNING is emitted.
 | 
					 * error is thrown. Otherwise a WARNING is emitted.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This is currently used for restore_end_command and restartpoint_command.
 | 
					 * This is currently used for restore_end_command and archive_cleanup_command.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
 | 
					ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
 | 
				
			||||||
@@ -5140,12 +5140,12 @@ readRecoveryCommandFile(void)
 | 
				
			|||||||
					(errmsg("recovery_end_command = '%s'",
 | 
										(errmsg("recovery_end_command = '%s'",
 | 
				
			||||||
							recoveryEndCommand)));
 | 
												recoveryEndCommand)));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (strcmp(tok1, "restartpoint_command") == 0)
 | 
							else if (strcmp(tok1, "archive_cleanup_command") == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			restartPointCommand = pstrdup(tok2);
 | 
								archiveCleanupCommand = pstrdup(tok2);
 | 
				
			||||||
			ereport(DEBUG2,
 | 
								ereport(DEBUG2,
 | 
				
			||||||
					(errmsg("restartpoint_command = '%s'",
 | 
										(errmsg("archive_cleanup_command = '%s'",
 | 
				
			||||||
							restartPointCommand)));
 | 
												archiveCleanupCommand)));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (strcmp(tok1, "recovery_target_timeline") == 0)
 | 
							else if (strcmp(tok1, "recovery_target_timeline") == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -5752,13 +5752,13 @@ StartupXLOG(void)
 | 
				
			|||||||
						ControlFile->checkPointCopy.ThisTimeLineID)));
 | 
											ControlFile->checkPointCopy.ThisTimeLineID)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Save the selected recovery target timeline ID and restartpoint_command
 | 
						 * Save the selected recovery target timeline ID and archive_cleanup_command
 | 
				
			||||||
	 * in shared memory so that other processes can see them
 | 
						 * in shared memory so that other processes can see them
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	XLogCtl->RecoveryTargetTLI = recoveryTargetTLI;
 | 
						XLogCtl->RecoveryTargetTLI = recoveryTargetTLI;
 | 
				
			||||||
	strncpy(XLogCtl->restartPointCommand,
 | 
						strncpy(XLogCtl->archiveCleanupCommand,
 | 
				
			||||||
			restartPointCommand ? restartPointCommand : "",
 | 
								archiveCleanupCommand ? archiveCleanupCommand : "",
 | 
				
			||||||
			sizeof(XLogCtl->restartPointCommand));
 | 
								sizeof(XLogCtl->archiveCleanupCommand));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (InArchiveRecovery)
 | 
						if (InArchiveRecovery)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -7675,11 +7675,11 @@ CreateRestartPoint(int flags)
 | 
				
			|||||||
	LWLockRelease(CheckpointLock);
 | 
						LWLockRelease(CheckpointLock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Finally, execute restartpoint_command, if any.
 | 
						 * Finally, execute archive_cleanup_command, if any.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (XLogCtl->restartPointCommand[0])
 | 
						if (XLogCtl->archiveCleanupCommand[0])
 | 
				
			||||||
		ExecuteRecoveryCommand(XLogCtl->restartPointCommand,
 | 
							ExecuteRecoveryCommand(XLogCtl->archiveCleanupCommand,
 | 
				
			||||||
							   "restartpoint_command",
 | 
												   "archive_cleanup_command",
 | 
				
			||||||
							   false);
 | 
												   false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user