aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2019-01-11 10:36:10 +0100
committerPeter Eisentraut <peter@eisentraut.org>2019-01-13 10:01:05 +0100
commit0acb3bc33af11a57d560cbce5a74246eb3e642db (patch)
tree1745226472594f81ff53e720b522c224f08984ac /src
parent373bda61d2d620e704815553978726c9be9e1209 (diff)
downloadpostgresql-0acb3bc33af11a57d560cbce5a74246eb3e642db.tar.gz
postgresql-0acb3bc33af11a57d560cbce5a74246eb3e642db.zip
Change default of recovery_target_timeline to 'latest'
This is what one usually wants for recovery and almost always wants for a standby. Discussion: https://www.postgresql.org/message-id/flat/6dd2c23a-4162-8469-410f-bfe146e28c0c@2ndquadrant.com/ Reviewed-by: David Steele <david@pgmasters.net> Reviewed-by: Michael Paquier <michael@paquier.xyz>
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c2
-rw-r--r--src/backend/utils/misc/guc.c7
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
-rw-r--r--src/bin/pg_rewind/RewindTest.pm2
-rw-r--r--src/test/recovery/t/004_timeline_switch.pl1
-rw-r--r--src/test/recovery/t/009_twophase.pl12
-rw-r--r--src/test/recovery/t/012_subtransactions.pl12
7 files changed, 6 insertions, 32 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9823b757676..2ab7d804f03 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -324,7 +324,7 @@ static bool recoveryStopAfter;
* 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;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 7eda7fdef9a..ae925c16509 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",
+ "latest",
check_recovery_target_timeline, assign_recovery_target_timeline, NULL
},
@@ -11028,7 +11028,7 @@ show_data_directory_mode(void)
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)
@@ -11037,6 +11037,8 @@ check_recovery_target_timeline(char **newval, void **extra, GucSource source)
rttg = RECOVERY_TARGET_TIMELINE_LATEST;
else
{
+ rttg = RECOVERY_TARGET_TIMELINE_NUMERIC;
+
errno = 0;
strtoul(*newval, NULL, 0);
if (errno == EINVAL || errno == ERANGE)
@@ -11044,7 +11046,6 @@ check_recovery_target_timeline(char **newval, void **extra, GucSource source)
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));
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index f7c1dee2402..a21865a77fa 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -261,7 +261,7 @@
# 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)
diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm
index 3d07da5d949..85cae7e47b1 100644
--- a/src/bin/pg_rewind/RewindTest.pm
+++ b/src/bin/pg_rewind/RewindTest.pm
@@ -161,7 +161,6 @@ sub create_standby
$node_standby->append_conf(
"postgresql.conf", qq(
primary_conninfo='$connstr_master application_name=rewind_standby'
-recovery_target_timeline='latest'
));
$node_standby->set_standby_mode();
@@ -273,7 +272,6 @@ sub run_pg_rewind
$node_master->append_conf(
'postgresql.conf', qq(
primary_conninfo='port=$port_standby'
-recovery_target_timeline='latest'
));
$node_master->set_standby_mode();
diff --git a/src/test/recovery/t/004_timeline_switch.pl b/src/test/recovery/t/004_timeline_switch.pl
index 79cbffb827b..2b315854bc5 100644
--- a/src/test/recovery/t/004_timeline_switch.pl
+++ b/src/test/recovery/t/004_timeline_switch.pl
@@ -51,7 +51,6 @@ my $connstr_1 = $node_standby_1->connstr;
$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;
diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl
index dac2d4ec0d6..2be1afcd8ba 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -229,10 +229,6 @@ is($psql_rc, '0', "Restore of prepared transaction on promoted standby");
# 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;
###############################################################################
@@ -267,10 +263,6 @@ is($psql_out, '1',
# 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'");
@@ -307,10 +299,6 @@ is($psql_out, '1',
# 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'");
diff --git a/src/test/recovery/t/012_subtransactions.pl b/src/test/recovery/t/012_subtransactions.pl
index e26cc9c2ce1..c1845536942 100644
--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -119,10 +119,6 @@ is($psql_out, '8128', "Visible");
# 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',
@@ -170,10 +166,6 @@ is($psql_out, '-1', "Not visible");
# 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',
@@ -211,10 +203,6 @@ is($psql_out, '-1', "Not visible");
# 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',