Skip to content

Commit 5f65396

Browse files
committed
pg_upgrade: properly handle timeline variables
There is no behavior change here as we now always set the timeline to one. Report by Tom Lane Backpatch to 9.3 and 9.4
1 parent 73f074c commit 5f65396

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

contrib/pg_upgrade/controldata.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
228228
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
229229

230230
p++; /* removing ':' char */
231-
cluster->controldata.chkpnt_tli = str2uint(p);
231+
tli = str2uint(p);
232232
got_tli = true;
233233
}
234234
else if ((p = strstr(bufin, "Latest checkpoint's NextXID:")) != NULL)
@@ -478,11 +478,11 @@ get_control_data(ClusterInfo *cluster, bool live_check)
478478
* Before 9.3, pg_resetxlog reported the xlogid and segno of the first log
479479
* file after reset as separate lines. Starting with 9.3, it reports the
480480
* WAL file name. If the old cluster is older than 9.3, we construct the
481-
* WAL file name from the xlogid and segno.
481+
* WAL file name from the tli, xlogid, and segno.
482482
*/
483483
if (GET_MAJOR_VERSION(cluster->major_version) <= 902)
484484
{
485-
if (got_log_id && got_log_seg)
485+
if (got_tli && got_log_id && got_log_seg)
486486
{
487487
snprintf(cluster->controldata.nextxlogfile, 25, "%08X%08X%08X",
488488
tli, logid, segno);
@@ -496,7 +496,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
496496
(!got_oldestmulti &&
497497
cluster->controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER) ||
498498
(!live_check && !got_nextxlogfile) ||
499-
!got_tli ||
500499
!got_align || !got_blocksz || !got_largesz || !got_walsz ||
501500
!got_walseg || !got_ident || !got_index || !got_toast ||
502501
!got_date_is_int || !got_float8_pass_by_value || !got_data_checksum_version)
@@ -524,9 +523,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
524523
if (!live_check && !got_nextxlogfile)
525524
pg_log(PG_REPORT, " first WAL segment after reset\n");
526525

527-
if (!got_tli)
528-
pg_log(PG_REPORT, " latest checkpoint timeline ID\n");
529-
530526
if (!got_align)
531527
pg_log(PG_REPORT, " maximum alignment\n");
532528

contrib/pg_upgrade/pg_upgrade.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ typedef struct
193193
uint32 ctrl_ver;
194194
uint32 cat_ver;
195195
char nextxlogfile[25];
196-
uint32 chkpnt_tli;
197196
uint32 chkpnt_nxtxid;
198197
uint32 chkpnt_nxtepoch;
199198
uint32 chkpnt_nxtoid;

0 commit comments

Comments
 (0)