Skip to content

Commit 41179e7

Browse files
committed
-- email subject limit -----------------------------------------
-- gitweb summary limit -------------------------- pg_upgrade: reorder controldata checks to match program output Also improve comment for how float8_pass_by_value is used. Backpatch through 9.5
1 parent bf8a361 commit 41179e7

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

src/bin/pg_upgrade/controldata.c

+39-35
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ get_control_data(ClusterInfo *cluster, bool live_check)
3737
char bufin[MAX_STRING];
3838
FILE *output;
3939
char *p;
40+
bool got_tli = false;
41+
bool got_log_id = false;
42+
bool got_log_seg = false;
4043
bool got_xid = false;
4144
bool got_oid = false;
42-
bool got_nextxlogfile = false;
4345
bool got_multi = false;
44-
bool got_mxoff = false;
4546
bool got_oldestmulti = false;
46-
bool got_log_id = false;
47-
bool got_log_seg = false;
48-
bool got_tli = false;
47+
bool got_mxoff = false;
48+
bool got_nextxlogfile = false;
49+
bool got_float8_pass_by_value = false;
4950
bool got_align = false;
5051
bool got_blocksz = false;
5152
bool got_largesz = false;
@@ -56,7 +57,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
5657
bool got_toast = false;
5758
bool got_large_object = false;
5859
bool got_date_is_int = false;
59-
bool got_float8_pass_by_value = false;
6060
bool got_data_checksum_version = false;
6161
char *lc_collate = NULL;
6262
char *lc_ctype = NULL;
@@ -67,9 +67,9 @@ get_control_data(ClusterInfo *cluster, bool live_check)
6767
char *language = NULL;
6868
char *lc_all = NULL;
6969
char *lc_messages = NULL;
70+
uint32 tli = 0;
7071
uint32 logid = 0;
7172
uint32 segno = 0;
72-
uint32 tli = 0;
7373

7474

7575
/*
@@ -154,38 +154,38 @@ get_control_data(ClusterInfo *cluster, bool live_check)
154154
p++; /* remove ':' char */
155155
cluster->controldata.cat_ver = str2uint(p);
156156
}
157-
else if ((p = strstr(bufin, "First log file ID after reset:")) != NULL)
157+
else if ((p = strstr(bufin, "Latest checkpoint's TimeLineID:")) != NULL)
158158
{
159159
p = strchr(p, ':');
160160

161161
if (p == NULL || strlen(p) <= 1)
162162
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
163163

164164
p++; /* remove ':' char */
165-
logid = str2uint(p);
166-
got_log_id = true;
165+
tli = str2uint(p);
166+
got_tli = true;
167167
}
168-
else if ((p = strstr(bufin, "First log file segment after reset:")) != NULL)
168+
else if ((p = strstr(bufin, "First log file ID after reset:")) != NULL)
169169
{
170170
p = strchr(p, ':');
171171

172172
if (p == NULL || strlen(p) <= 1)
173173
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
174174

175175
p++; /* remove ':' char */
176-
segno = str2uint(p);
177-
got_log_seg = true;
176+
logid = str2uint(p);
177+
got_log_id = true;
178178
}
179-
else if ((p = strstr(bufin, "Latest checkpoint's TimeLineID:")) != NULL)
179+
else if ((p = strstr(bufin, "First log file segment after reset:")) != NULL)
180180
{
181181
p = strchr(p, ':');
182182

183183
if (p == NULL || strlen(p) <= 1)
184184
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
185185

186186
p++; /* remove ':' char */
187-
tli = str2uint(p);
188-
got_tli = true;
187+
segno = str2uint(p);
188+
got_log_seg = true;
189189
}
190190
else if ((p = strstr(bufin, "Latest checkpoint's NextXID:")) != NULL)
191191
{
@@ -266,6 +266,18 @@ get_control_data(ClusterInfo *cluster, bool live_check)
266266
strlcpy(cluster->controldata.nextxlogfile, p, 25);
267267
got_nextxlogfile = true;
268268
}
269+
else if ((p = strstr(bufin, "Float8 argument passing:")) != NULL)
270+
{
271+
p = strchr(p, ':');
272+
273+
if (p == NULL || strlen(p) <= 1)
274+
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
275+
276+
p++; /* remove ':' char */
277+
/* used later for contrib check */
278+
cluster->controldata.float8_pass_by_value = strstr(p, "by value") != NULL;
279+
got_float8_pass_by_value = true;
280+
}
269281
else if ((p = strstr(bufin, "Maximum data alignment:")) != NULL)
270282
{
271283
p = strchr(p, ':');
@@ -376,18 +388,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
376388
cluster->controldata.date_is_int = strstr(p, "64-bit integers") != NULL;
377389
got_date_is_int = true;
378390
}
379-
else if ((p = strstr(bufin, "Float8 argument passing:")) != NULL)
380-
{
381-
p = strchr(p, ':');
382-
383-
if (p == NULL || strlen(p) <= 1)
384-
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
385-
386-
p++; /* remove ':' char */
387-
/* used later for contrib check */
388-
cluster->controldata.float8_pass_by_value = strstr(p, "by value") != NULL;
389-
got_float8_pass_by_value = true;
390-
}
391391
else if ((p = strstr(bufin, "checksum")) != NULL)
392392
{
393393
p = strchr(p, ':');
@@ -449,11 +449,12 @@ get_control_data(ClusterInfo *cluster, bool live_check)
449449
(!got_oldestmulti &&
450450
cluster->controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER) ||
451451
!got_mxoff || (!live_check && !got_nextxlogfile) ||
452-
!got_align || !got_blocksz || !got_largesz || !got_walsz ||
453-
!got_walseg || !got_ident || !got_index || !got_toast ||
452+
!got_float8_pass_by_value || !got_align || !got_blocksz ||
453+
!got_largesz || !got_walsz || !got_walseg || !got_ident ||
454+
!got_index || !got_toast ||
454455
(!got_large_object &&
455456
cluster->controldata.ctrl_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER) ||
456-
!got_date_is_int || !got_float8_pass_by_value || !got_data_checksum_version)
457+
!got_date_is_int || !got_data_checksum_version)
457458
{
458459
pg_log(PG_REPORT,
459460
"The %s cluster lacks some required control information:\n",
@@ -478,6 +479,9 @@ get_control_data(ClusterInfo *cluster, bool live_check)
478479
if (!live_check && !got_nextxlogfile)
479480
pg_log(PG_REPORT, " first WAL segment after reset\n");
480481

482+
if (!got_float8_pass_by_value)
483+
pg_log(PG_REPORT, " float8 argument passing method\n");
484+
481485
if (!got_align)
482486
pg_log(PG_REPORT, " maximum alignment\n");
483487

@@ -509,9 +513,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
509513
if (!got_date_is_int)
510514
pg_log(PG_REPORT, " dates/times are integers?\n");
511515

512-
if (!got_float8_pass_by_value)
513-
pg_log(PG_REPORT, " float8 argument passing method\n");
514-
515516
/* value added in Postgres 9.3 */
516517
if (!got_data_checksum_version)
517518
pg_log(PG_REPORT, " data checksum version\n");
@@ -563,7 +564,10 @@ check_control_data(ControlData *oldctrl,
563564
if (oldctrl->date_is_int != newctrl->date_is_int)
564565
pg_fatal("old and new pg_controldata date/time storage types do not match\n");
565566

566-
/* float8_pass_by_value does not need to match */
567+
/*
568+
* float8_pass_by_value does not need to match, but is used in
569+
* check_for_isn_and_int8_passing_mismatch().
570+
*/
567571

568572
/*
569573
* We might eventually allow upgrades from checksum to no-checksum

0 commit comments

Comments
 (0)