From d4949efdfb246585495566cf8a5d85761554986c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 28 Dec 2018 10:44:12 +0100 Subject: [PATCH v2 1/2] Add value 'current' for recovery_target_timeline This value represents the default behavior of using the current timeline. Previously, this was represented by an empty string. (Before the removal of recovery.conf, this setting could not be chosen explicitly but was used when recovery_target_timeline was not mentioned at all.) --- doc/src/sgml/config.sgml | 8 +++++--- src/backend/utils/misc/guc.c | 4 ++-- src/backend/utils/misc/postgresql.conf.sample | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index e94b305add..cf4d8ab219 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -3350,9 +3350,11 @@ Recovery Target - Specifies recovering into a particular timeline. The default is - to recover along the same timeline that was current when the - base backup was taken. Setting this to latest recovers + Specifies recovering into a particular timeline. The value can be a + numeric timeline ID or a special value. The value + current recovers along the same timeline that was + current when the base backup was taken. That is the default. The + value latest 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 in complex re-recovery situations, where you need to return to diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 6fe1939881..6342872b0d 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -3387,7 +3387,7 @@ static struct config_string ConfigureNamesString[] = NULL }, &recovery_target_timeline_string, - "", + "current", check_recovery_target_timeline, assign_recovery_target_timeline, NULL }, @@ -11031,7 +11031,7 @@ check_recovery_target_timeline(char **newval, void **extra, GucSource source) RecoveryTargetTimeLineGoal rttg = RECOVERY_TARGET_TIMELINE_CONTROLFILE; RecoveryTargetTimeLineGoal *myextra; - if (strcmp(*newval, "") == 0) + if (strcmp(*newval, "current") == 0) rttg = RECOVERY_TARGET_TIMELINE_CONTROLFILE; else if (strcmp(*newval, "latest") == 0) rttg = RECOVERY_TARGET_TIMELINE_LATEST; diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 1fa02d2c93..f7c1dee240 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -261,8 +261,7 @@ # just after the specified recovery target (on) # just before the recovery target (off) # (change requires restart) -#recovery_target_timeline = '' # unset means read from control file (default), - # or set to 'latest' or timeline ID +#recovery_target_timeline = 'current' # 'current', 'latest', or timeline ID # (change requires restart) #recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown' # (change requires restart) -- 2.20.1