Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0acb3bc

Browse files
committed
Change default of recovery_target_timeline to 'latest'
This is what one usually wants for recovery and almost always wantsfor 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>
1 parent373bda6 commit0acb3bc

File tree

9 files changed

+15
-37
lines changed

9 files changed

+15
-37
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,10 +3353,14 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
33533353
Specifies recovering into a particular timeline. The value can be a
33543354
numeric timeline ID or a special value. The value
33553355
<literal>current</literal> recovers along the same timeline that was
3356-
current when the base backup was taken.That is the default.The
3356+
current when the base backup was taken. The
33573357
value <literal>latest</literal> recovers
33583358
to the latest timeline found in the archive, which is useful in
3359-
a standby server. Other than that you only need to set this parameter
3359+
a standby server. <literal>latest</literal> is the default.
3360+
</para>
3361+
3362+
<para>
3363+
You usually only need to set this parameter
33603364
in complex re-recovery situations, where you need to return to
33613365
a state that itself was reached after a point-in-time recovery.
33623366
See <xref linkend="backup-timelines"/> for discussion.

‎doc/src/sgml/high-availability.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,8 @@ protocol to make nodes agree on a serializable transactional order.
690690
<filename>standby.signal</filename> in the standby's cluster data
691691
directory. Set <xref linkend="guc-restore-command"/> to a simple command to copy files from
692692
the WAL archive. If you plan to have multiple standby servers for high
693-
availability purposes,set<varname>recovery_target_timeline</varname> to
694-
<literal>latest</literal>, to make the standby server follow the timeline change
693+
availability purposes,make sure that<varname>recovery_target_timeline</varname> is set to
694+
<literal>latest</literal> (the default), to make the standby server follow the timeline change
695695
that occurs at failover to another standby.
696696
</para>
697697

@@ -1024,7 +1024,7 @@ primary_slot_name = 'node_a_slot'
10241024
<para>
10251025
If an upstream standby server is promoted to become new master, downstream
10261026
servers will continue to stream from the new master if
1027-
<varname>recovery_target_timeline</varname> is set to <literal>'latest'</literal>.
1027+
<varname>recovery_target_timeline</varname> is set to <literal>'latest'</literal> (the default).
10281028
</para>
10291029

10301030
<para>

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static bool recoveryStopAfter;
324324
* file was created.) During a sequential scan we do not allow this value
325325
* to decrease.
326326
*/
327-
RecoveryTargetTimeLineGoalrecoveryTargetTimeLineGoal=RECOVERY_TARGET_TIMELINE_CONTROLFILE;
327+
RecoveryTargetTimeLineGoalrecoveryTargetTimeLineGoal=RECOVERY_TARGET_TIMELINE_LATEST;
328328
TimeLineIDrecoveryTargetTLIRequested=0;
329329
TimeLineIDrecoveryTargetTLI=0;
330330
staticList*expectedTLEs;

‎src/backend/utils/misc/guc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,7 +3387,7 @@ static struct config_string ConfigureNamesString[] =
33873387
NULL
33883388
},
33893389
&recovery_target_timeline_string,
3390-
"current",
3390+
"latest",
33913391
check_recovery_target_timeline,assign_recovery_target_timeline,NULL
33923392
},
33933393

@@ -11028,7 +11028,7 @@ show_data_directory_mode(void)
1102811028
staticbool
1102911029
check_recovery_target_timeline(char**newval,void**extra,GucSourcesource)
1103011030
{
11031-
RecoveryTargetTimeLineGoalrttg=RECOVERY_TARGET_TIMELINE_CONTROLFILE;
11031+
RecoveryTargetTimeLineGoalrttg;
1103211032
RecoveryTargetTimeLineGoal*myextra;
1103311033

1103411034
if (strcmp(*newval,"current")==0)
@@ -11037,14 +11037,15 @@ check_recovery_target_timeline(char **newval, void **extra, GucSource source)
1103711037
rttg=RECOVERY_TARGET_TIMELINE_LATEST;
1103811038
else
1103911039
{
11040+
rttg=RECOVERY_TARGET_TIMELINE_NUMERIC;
11041+
1104011042
errno=0;
1104111043
strtoul(*newval,NULL,0);
1104211044
if (errno==EINVAL||errno==ERANGE)
1104311045
{
1104411046
GUC_check_errdetail("recovery_target_timeline is not a valid number.");
1104511047
return false;
1104611048
}
11047-
rttg=RECOVERY_TARGET_TIMELINE_NUMERIC;
1104811049
}
1104911050

1105011051
myextra= (RecoveryTargetTimeLineGoal*)guc_malloc(ERROR,sizeof(RecoveryTargetTimeLineGoal));

‎src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
# just after the specified recovery target (on)
262262
# just before the recovery target (off)
263263
# (change requires restart)
264-
#recovery_target_timeline = 'current'# 'current', 'latest', or timeline ID
264+
#recovery_target_timeline = 'latest'# 'current', 'latest', or timeline ID
265265
# (change requires restart)
266266
#recovery_target_action = 'pause'# 'pause', 'promote', 'shutdown'
267267
# (change requires restart)

‎src/bin/pg_rewind/RewindTest.pm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ sub create_standby
161161
$node_standby->append_conf(
162162
"postgresql.conf",qq(
163163
primary_conninfo='$connstr_master application_name=rewind_standby'
164-
recovery_target_timeline='latest'
165164
));
166165

167166
$node_standby->set_standby_mode();
@@ -273,7 +272,6 @@ sub run_pg_rewind
273272
$node_master->append_conf(
274273
'postgresql.conf',qq(
275274
primary_conninfo='port=$port_standby'
276-
recovery_target_timeline='latest'
277275
));
278276

279277
$node_master->set_standby_mode();

‎src/test/recovery/t/004_timeline_switch.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
$node_standby_2->append_conf(
5252
'postgresql.conf',qq(
5353
primary_conninfo='$connstr_1 application_name=@{[$node_standby_2->name]}'
54-
recovery_target_timeline='latest'
5554
));
5655
$node_standby_2->restart;
5756

‎src/test/recovery/t/009_twophase.pl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,6 @@ sub configure_and_reload
229229

230230
# restart old master as new standby
231231
$cur_standby->enable_streaming($cur_master);
232-
$cur_standby->append_conf(
233-
'postgresql.conf',qq(
234-
recovery_target_timeline='latest'
235-
));
236232
$cur_standby->start;
237233

238234
###############################################################################
@@ -267,10 +263,6 @@ sub configure_and_reload
267263

268264
# restart old master as new standby
269265
$cur_standby->enable_streaming($cur_master);
270-
$cur_standby->append_conf(
271-
'postgresql.conf',qq(
272-
recovery_target_timeline='latest'
273-
));
274266
$cur_standby->start;
275267

276268
$cur_master->psql('postgres',"COMMIT PREPARED 'xact_009_11'");
@@ -307,10 +299,6 @@ sub configure_and_reload
307299

308300
# restart old master as new standby
309301
$cur_standby->enable_streaming($cur_master);
310-
$cur_standby->append_conf(
311-
'postgresql.conf',qq(
312-
recovery_target_timeline='latest'
313-
));
314302
$cur_standby->start;
315303

316304
$cur_master->psql('postgres',"COMMIT PREPARED 'xact_009_12'");

‎src/test/recovery/t/012_subtransactions.pl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@
119119
# restore state
120120
($node_master,$node_standby) = ($node_standby,$node_master);
121121
$node_standby->enable_streaming($node_master);
122-
$node_standby->append_conf(
123-
'postgresql.conf',qq(
124-
recovery_target_timeline='latest'
125-
));
126122
$node_standby->start;
127123
$node_standby->psql(
128124
'postgres',
@@ -170,10 +166,6 @@
170166
# restore state
171167
($node_master,$node_standby) = ($node_standby,$node_master);
172168
$node_standby->enable_streaming($node_master);
173-
$node_standby->append_conf(
174-
'postgresql.conf',qq(
175-
recovery_target_timeline='latest'
176-
));
177169
$node_standby->start;
178170
$psql_rc =$node_master->psql('postgres',"COMMIT PREPARED 'xact_012_1'");
179171
is($psql_rc,'0',
@@ -211,10 +203,6 @@
211203
# restore state
212204
($node_master,$node_standby) = ($node_standby,$node_master);
213205
$node_standby->enable_streaming($node_master);
214-
$node_standby->append_conf(
215-
'postgresql.conf',qq(
216-
recovery_target_timeline='latest'
217-
));
218206
$node_standby->start;
219207
$psql_rc =$node_master->psql('postgres',"ROLLBACK PREPARED 'xact_012_1'");
220208
is($psql_rc,'0',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp