Rename min_recovery_apply_delay to recovery_min_apply_delay.

Per discussion, this seems like a more consistent choice of name.

Fabrízio de Royes Mello, after a suggestion by Peter Eisentraut;
some additional documentation wordsmithing by me
This commit is contained in:
Tom Lane 2014-05-10 19:46:19 -04:00
parent f825c7c850
commit 0d0b2bf175
4 changed files with 27 additions and 26 deletions

View File

@ -403,15 +403,15 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="min-recovery-apply-delay" xreflabel="min_recovery_apply_delay"> <varlistentry id="recovery-min-apply-delay" xreflabel="recovery_min_apply_delay">
<term><varname>min_recovery_apply_delay</varname> (<type>integer</type>) <term><varname>recovery_min_apply_delay</varname> (<type>integer</type>)
<indexterm> <indexterm>
<primary><varname>min_recovery_apply_delay</> recovery parameter</primary> <primary><varname>recovery_min_apply_delay</> recovery parameter</primary>
</indexterm> </indexterm>
</term> </term>
<listitem> <listitem>
<para> <para>
By default, a standby server keeps restoring WAL records from the By default, a standby server restores WAL records from the
primary as soon as possible. It may be useful to have a time-delayed primary as soon as possible. It may be useful to have a time-delayed
copy of the data, offering various options to correct data loss errors. copy of the data, offering various options to correct data loss errors.
This parameter allows you to delay recovery by a fixed period of time, This parameter allows you to delay recovery by a fixed period of time,
@ -428,15 +428,15 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
in transfer because of networks or cascading replication configurations in transfer because of networks or cascading replication configurations
may reduce the actual wait time significantly. If the system may reduce the actual wait time significantly. If the system
clocks on master and standby are not synchronised, this may lead to clocks on master and standby are not synchronised, this may lead to
recovery applying records earlier than expected but is not a major issue recovery applying records earlier than expected; but that is not a
because the useful settings of the parameter are much larger than major issue because useful settings of the parameter are much larger
typical time deviation between the servers. Be careful to allow for than typical time deviations between servers. Be careful to allow for
different timezone settings on master and standby. different timezone settings on master and standby.
</para> </para>
<para> <para>
The delay occurs only on WAL records for COMMIT and Restore Points. The delay occurs only on WAL records for COMMIT and Restore Points.
Other records may be replayed earlier than the specified delay, which Other records may be replayed earlier than the specified delay, which
is not an issue for MVCC though may potentially increase the number is not an issue for MVCC though it may potentially increase the number
of recovery conflicts generated. of recovery conflicts generated.
</para> </para>
<para> <para>

View File

@ -775,10 +775,10 @@
<listitem> <listitem>
<para> <para>
Allow <link Add <link
linkend="recovery-config"><filename>recovery.conf</></link> linkend="recovery-config"><filename>recovery.conf</></link>
parameter <link parameter <link
linkend="min-recovery-apply-delay"><varname>min_recovery_apply_delay</></link> linkend="recovery-min-apply-delay"><varname>recovery_min_apply_delay</></link>
to force delayed replication (Robert Haas, Fabr&iacute;zio de to force delayed replication (Robert Haas, Fabr&iacute;zio de
Royes Mello, Simon Riggs) Royes Mello, Simon Riggs)
</para> </para>

View File

@ -129,20 +129,20 @@
# #
# By default, a standby server keeps restoring XLOG records from the # By default, a standby server keeps restoring XLOG records from the
# primary indefinitely. If you want to stop the standby mode, finish recovery # primary indefinitely. If you want to stop the standby mode, finish recovery
# and open the system in read/write mode, specify path to a trigger file. # and open the system in read/write mode, specify a path to a trigger file.
# The server will poll the trigger file path periodically and start as a # The server will poll the trigger file path periodically and start as a
# primary server when it's found. # primary server when it's found.
# #
#trigger_file = '' #trigger_file = ''
# #
# By default, a standby server keeps restoring XLOG records from the # By default, a standby server restores XLOG records from the primary as
# primary as soon as possible. If you want to explicitly delay the replay of # soon as possible. If you want to explicitly delay the replay of committed
# committed transactions from the master, specify a recovery apply delay. # transactions from the master, specify a minimum apply delay. For example,
# For example, if you set this parameter to 5min, the standby will replay # if you set this parameter to 5min, the standby will replay each transaction
# each transaction commit only when the system time on the standby is at # commit only when the system time on the standby is at least five minutes
# least five minutes past the commit time reported by the master. # past the commit time reported by the master.
# #
#min_recovery_apply_delay = 0 #recovery_min_apply_delay = 0
# #
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# HOT STANDBY PARAMETERS # HOT STANDBY PARAMETERS

View File

@ -223,7 +223,7 @@ static bool recoveryPauseAtTarget = true;
static TransactionId recoveryTargetXid; static TransactionId recoveryTargetXid;
static TimestampTz recoveryTargetTime; static TimestampTz recoveryTargetTime;
static char *recoveryTargetName; static char *recoveryTargetName;
static int min_recovery_apply_delay = 0; static int recovery_min_apply_delay = 0;
static TimestampTz recoveryDelayUntilTime; static TimestampTz recoveryDelayUntilTime;
/* options taken from recovery.conf for XLOG streaming */ /* options taken from recovery.conf for XLOG streaming */
@ -5236,18 +5236,19 @@ readRecoveryCommandFile(void)
(errmsg_internal("trigger_file = '%s'", (errmsg_internal("trigger_file = '%s'",
TriggerFile))); TriggerFile)));
} }
else if (strcmp(item->name, "min_recovery_apply_delay") == 0) else if (strcmp(item->name, "recovery_min_apply_delay") == 0)
{ {
const char *hintmsg; const char *hintmsg;
if (!parse_int(item->value, &min_recovery_apply_delay, GUC_UNIT_MS, if (!parse_int(item->value, &recovery_min_apply_delay, GUC_UNIT_MS,
&hintmsg)) &hintmsg))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("parameter \"%s\" requires a temporal value", "min_recovery_apply_delay"), errmsg("parameter \"%s\" requires a temporal value",
"recovery_min_apply_delay"),
hintmsg ? errhint("%s", _(hintmsg)) : 0)); hintmsg ? errhint("%s", _(hintmsg)) : 0));
ereport(DEBUG2, ereport(DEBUG2,
(errmsg("min_recovery_apply_delay = '%s'", item->value))); (errmsg("recovery_min_apply_delay = '%s'", item->value)));
} }
else else
ereport(FATAL, ereport(FATAL,
@ -5669,7 +5670,7 @@ SetRecoveryPause(bool recoveryPause)
} }
/* /*
* When min_recovery_apply_delay is set, we wait long enough to make sure * When recovery_min_apply_delay is set, we wait long enough to make sure
* certain record types are applied at least that interval behind the master. * certain record types are applied at least that interval behind the master.
* *
* Returns true if we waited. * Returns true if we waited.
@ -5690,7 +5691,7 @@ recoveryApplyDelay(XLogRecord *record)
int microsecs; int microsecs;
/* nothing to do if no delay configured */ /* nothing to do if no delay configured */
if (min_recovery_apply_delay == 0) if (recovery_min_apply_delay == 0)
return false; return false;
/* /*
@ -5711,7 +5712,7 @@ recoveryApplyDelay(XLogRecord *record)
return false; return false;
recoveryDelayUntilTime = recoveryDelayUntilTime =
TimestampTzPlusMilliseconds(xtime, min_recovery_apply_delay); TimestampTzPlusMilliseconds(xtime, recovery_min_apply_delay);
/* /*
* Exit without arming the latch if it's already past time to apply this * Exit without arming the latch if it's already past time to apply this