Specifies recovering into a particular timeline. The value can be a
numeric timeline ID or a special value. The value
<literal>current</literal> recovers along the same timeline that was
- current when the base backup was taken. That is the default. The
+ current when the base backup was taken. The
value <literal>latest</literal> recovers
to the latest timeline found in the archive, which is useful in
- a standby server. Other than that you only need to set this parameter
+ a standby server. <literal>latest</literal> is the default.
+ </para>
+
+ <para>
+ You usually only need to set this parameter
in complex re-recovery situations, where you need to return to
a state that itself was reached after a point-in-time recovery.
See <xref linkend="backup-timelines"/> for discussion.
<filename>standby.signal</filename> in the standby's cluster data
directory. Set <xref linkend="guc-restore-command"/> to a simple command to copy files from
the WAL archive. If you plan to have multiple standby servers for high
- availability purposes, set <varname>recovery_target_timeline</varname> to
- <literal>latest</literal>, to make the standby server follow the timeline change
+ availability purposes, make sure that <varname>recovery_target_timeline</varname> is set to
+ <literal>latest</literal> (the default), to make the standby server follow the timeline change
that occurs at failover to another standby.
</para>
<para>
If an upstream standby server is promoted to become new master, downstream
servers will continue to stream from the new master if
- <varname>recovery_target_timeline</varname> is set to <literal>'latest'</literal>.
+ <varname>recovery_target_timeline</varname> is set to <literal>'latest'</literal> (the default).
</para>
<para>
* file was created.) During a sequential scan we do not allow this value
* to decrease.
*/
-RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal = RECOVERY_TARGET_TIMELINE_CONTROLFILE;
+RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal = RECOVERY_TARGET_TIMELINE_LATEST;
TimeLineID recoveryTargetTLIRequested = 0;
TimeLineID recoveryTargetTLI = 0;
static List *expectedTLEs;
NULL
},
&recovery_target_timeline_string,
- "current",
+ "latest",
check_recovery_target_timeline, assign_recovery_target_timeline, NULL
},
static bool
check_recovery_target_timeline(char **newval, void **extra, GucSource source)
{
- RecoveryTargetTimeLineGoal rttg = RECOVERY_TARGET_TIMELINE_CONTROLFILE;
+ RecoveryTargetTimeLineGoal rttg;
RecoveryTargetTimeLineGoal *myextra;
if (strcmp(*newval, "current") == 0)
rttg = RECOVERY_TARGET_TIMELINE_LATEST;
else
{
+ rttg = RECOVERY_TARGET_TIMELINE_NUMERIC;
+
errno = 0;
strtoul(*newval, NULL, 0);
if (errno == EINVAL || errno == ERANGE)
GUC_check_errdetail("recovery_target_timeline is not a valid number.");
return false;
}
- rttg = RECOVERY_TARGET_TIMELINE_NUMERIC;
}
myextra = (RecoveryTargetTimeLineGoal *) guc_malloc(ERROR, sizeof(RecoveryTargetTimeLineGoal));
# just after the specified recovery target (on)
# just before the recovery target (off)
# (change requires restart)
-#recovery_target_timeline = 'current' # 'current', 'latest', or timeline ID
+#recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID
# (change requires restart)
#recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown'
# (change requires restart)
$node_standby->append_conf(
"postgresql.conf", qq(
primary_conninfo='$connstr_master application_name=rewind_standby'
-recovery_target_timeline='latest'
));
$node_standby->set_standby_mode();
$node_master->append_conf(
'postgresql.conf', qq(
primary_conninfo='port=$port_standby'
-recovery_target_timeline='latest'
));
$node_master->set_standby_mode();
$node_standby_2->append_conf(
'postgresql.conf', qq(
primary_conninfo='$connstr_1 application_name=@{[$node_standby_2->name]}'
-recovery_target_timeline='latest'
));
$node_standby_2->restart;
# restart old master as new standby
$cur_standby->enable_streaming($cur_master);
-$cur_standby->append_conf(
- 'postgresql.conf', qq(
-recovery_target_timeline='latest'
-));
$cur_standby->start;
###############################################################################
# restart old master as new standby
$cur_standby->enable_streaming($cur_master);
-$cur_standby->append_conf(
- 'postgresql.conf', qq(
-recovery_target_timeline='latest'
-));
$cur_standby->start;
$cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_11'");
# restart old master as new standby
$cur_standby->enable_streaming($cur_master);
-$cur_standby->append_conf(
- 'postgresql.conf', qq(
-recovery_target_timeline='latest'
-));
$cur_standby->start;
$cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_12'");
# restore state
($node_master, $node_standby) = ($node_standby, $node_master);
$node_standby->enable_streaming($node_master);
-$node_standby->append_conf(
- 'postgresql.conf', qq(
-recovery_target_timeline='latest'
-));
$node_standby->start;
$node_standby->psql(
'postgres',
# restore state
($node_master, $node_standby) = ($node_standby, $node_master);
$node_standby->enable_streaming($node_master);
-$node_standby->append_conf(
- 'postgresql.conf', qq(
-recovery_target_timeline='latest'
-));
$node_standby->start;
$psql_rc = $node_master->psql('postgres', "COMMIT PREPARED 'xact_012_1'");
is($psql_rc, '0',
# restore state
($node_master, $node_standby) = ($node_standby, $node_master);
$node_standby->enable_streaming($node_master);
-$node_standby->append_conf(
- 'postgresql.conf', qq(
-recovery_target_timeline='latest'
-));
$node_standby->start;
$psql_rc = $node_master->psql('postgres', "ROLLBACK PREPARED 'xact_012_1'");
is($psql_rc, '0',