Skip to content

Commit 87d3b35

Browse files
Fix pg_upgrade for 9.3 with data checksums.
Previous changes misconstrued pg_upgrade internals causing build farm breakages.
1 parent be475a2 commit 87d3b35

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

contrib/pg_upgrade/controldata.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
5656
bool got_toast = false;
5757
bool got_date_is_int = false;
5858
bool got_float8_pass_by_value = false;
59-
bool got_data_checksums = false;
59+
bool got_data_checksum_version = false;
6060
char *lc_collate = NULL;
6161
char *lc_ctype = NULL;
6262
char *lc_monetary = NULL;
@@ -135,8 +135,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
135135
/* Only in <= 9.2 */
136136
if (GET_MAJOR_VERSION(cluster->major_version) <= 902)
137137
{
138-
cluster->controldata.data_checksums = false;
139-
got_data_checksums = true;
138+
cluster->controldata.data_checksum_version = 0;
139+
got_data_checksum_version = true;
140140
}
141141

142142
/* we have the result of cmd in "output". so parse it line by line now */
@@ -401,7 +401,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
401401
cluster->controldata.float8_pass_by_value = strstr(p, "by value") != NULL;
402402
got_float8_pass_by_value = true;
403403
}
404-
else if ((p = strstr(bufin, "checksums")) != NULL)
404+
else if ((p = strstr(bufin, "checksum")) != NULL)
405405
{
406406
p = strchr(p, ':');
407407

@@ -410,8 +410,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
410410

411411
p++; /* removing ':' char */
412412
/* used later for contrib check */
413-
cluster->controldata.data_checksums = strstr(p, "enabled") != NULL;
414-
got_data_checksums = true;
413+
cluster->controldata.data_checksum_version = str2uint(p);
414+
got_data_checksum_version = true;
415415
}
416416
/* In pre-8.4 only */
417417
else if ((p = strstr(bufin, "LC_COLLATE:")) != NULL)
@@ -496,7 +496,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
496496
!got_tli ||
497497
!got_align || !got_blocksz || !got_largesz || !got_walsz ||
498498
!got_walseg || !got_ident || !got_index || !got_toast ||
499-
!got_date_is_int || !got_float8_pass_by_value || !got_data_checksums)
499+
!got_date_is_int || !got_float8_pass_by_value || !got_data_checksum_version)
500500
{
501501
pg_log(PG_REPORT,
502502
"The %s cluster lacks some required control information:\n",
@@ -556,8 +556,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
556556
pg_log(PG_REPORT, " float8 argument passing method\n");
557557

558558
/* value added in Postgres 9.3 */
559-
if (!got_data_checksums)
560-
pg_log(PG_REPORT, " data checksums\n");
559+
if (!got_data_checksum_version)
560+
pg_log(PG_REPORT, " data checksum version\n");
561561

562562
pg_log(PG_FATAL,
563563
"Cannot continue without required control information, terminating\n");
@@ -622,10 +622,10 @@ check_control_data(ControlData *oldctrl,
622622
}
623623

624624
/* We might eventually allow upgrades from checksum to no-checksum clusters. */
625-
if (oldctrl->data_checksums != newctrl->data_checksums)
625+
if (oldctrl->data_checksum_version != newctrl->data_checksum_version)
626626
{
627627
pg_log(PG_FATAL,
628-
"old and new pg_controldata checksums settings are invalid or do not match\n");
628+
"old and new pg_controldata checksum versions are invalid or do not match\n");
629629
}
630630
}
631631

contrib/pg_upgrade/pg_upgrade.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ typedef struct
202202
uint32 toast;
203203
bool date_is_int;
204204
bool float8_pass_by_value;
205-
bool data_checksums;
205+
bool data_checksum_version;
206206
char *lc_collate;
207207
char *lc_ctype;
208208
char *encoding;

0 commit comments

Comments
 (0)