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

Commit5a3022f

Browse files
committed
pg_upgrade: make controldata checks more consistent
Also add missing float8_pass_by_value check.
1 parenta486e35 commit5a3022f

File tree

2 files changed

+27
-29
lines changed

2 files changed

+27
-29
lines changed

‎src/bin/pg_upgrade/controldata.c

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
154154
p++;/* remove ':' char */
155155
cluster->controldata.cat_ver=str2uint(p);
156156
}
157-
elseif ((p=strstr(bufin,"First log segment after reset:"))!=NULL)
158-
{
159-
/* Skip the colon and any whitespace after it */
160-
p=strchr(p,':');
161-
if (p==NULL||strlen(p) <=1)
162-
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
163-
p=strpbrk(p,"01234567890ABCDEF");
164-
if (p==NULL||strlen(p) <=1)
165-
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
166-
167-
/* Make sure it looks like a valid WAL file name */
168-
if (strspn(p,"0123456789ABCDEF")!=24)
169-
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
170-
171-
strlcpy(cluster->controldata.nextxlogfile,p,25);
172-
got_nextxlogfile= true;
173-
}
174157
elseif ((p=strstr(bufin,"First log file ID after reset:"))!=NULL)
175158
{
176159
p=strchr(p,':');
@@ -201,7 +184,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
201184
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
202185

203186
p++;/* remove ':' char */
204-
cluster->controldata.chkpnt_tli=str2uint(p);
187+
tli=str2uint(p);
205188
got_tli= true;
206189
}
207190
elseif ((p=strstr(bufin,"Latest checkpoint's NextXID:"))!=NULL)
@@ -266,6 +249,23 @@ get_control_data(ClusterInfo *cluster, bool live_check)
266249
cluster->controldata.chkpnt_nxtmxoff=str2uint(p);
267250
got_mxoff= true;
268251
}
252+
elseif ((p=strstr(bufin,"First log segment after reset:"))!=NULL)
253+
{
254+
/* Skip the colon and any whitespace after it */
255+
p=strchr(p,':');
256+
if (p==NULL||strlen(p) <=1)
257+
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
258+
p=strpbrk(p,"01234567890ABCDEF");
259+
if (p==NULL||strlen(p) <=1)
260+
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
261+
262+
/* Make sure it looks like a valid WAL file name */
263+
if (strspn(p,"0123456789ABCDEF")!=24)
264+
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
265+
266+
strlcpy(cluster->controldata.nextxlogfile,p,25);
267+
got_nextxlogfile= true;
268+
}
269269
elseif ((p=strstr(bufin,"Maximum data alignment:"))!=NULL)
270270
{
271271
p=strchr(p,':');
@@ -436,7 +436,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
436436
*/
437437
if (GET_MAJOR_VERSION(cluster->major_version) <=902)
438438
{
439-
if (got_log_id&&got_log_seg)
439+
if (got_tli&&got_log_id&&got_log_seg)
440440
{
441441
snprintf(cluster->controldata.nextxlogfile,25,"%08X%08X%08X",
442442
tli,logid,segno);
@@ -446,11 +446,10 @@ get_control_data(ClusterInfo *cluster, bool live_check)
446446

447447
/* verify that we got all the mandatory pg_control data */
448448
if (!got_xid|| !got_oid||
449-
!got_multi|| !got_mxoff||
449+
!got_multi||
450450
(!got_oldestmulti&&
451451
cluster->controldata.cat_ver >=MULTIXACT_FORMATCHANGE_CAT_VER)||
452-
(!live_check&& !got_nextxlogfile)||
453-
!got_tli||
452+
!got_mxoff|| (!live_check&& !got_nextxlogfile)||
454453
!got_align|| !got_blocksz|| !got_largesz|| !got_walsz||
455454
!got_walseg|| !got_ident|| !got_index|| !got_toast||
456455
(!got_large_object&&
@@ -470,19 +469,16 @@ get_control_data(ClusterInfo *cluster, bool live_check)
470469
if (!got_multi)
471470
pg_log(PG_REPORT," latest checkpoint next MultiXactId\n");
472471

473-
if (!got_mxoff)
474-
pg_log(PG_REPORT," latest checkpoint next MultiXactOffset\n");
475-
476472
if (!got_oldestmulti&&
477473
cluster->controldata.cat_ver >=MULTIXACT_FORMATCHANGE_CAT_VER)
478474
pg_log(PG_REPORT," latest checkpoint oldest MultiXactId\n");
479475

476+
if (!got_mxoff)
477+
pg_log(PG_REPORT," latest checkpoint next MultiXactOffset\n");
478+
480479
if (!live_check&& !got_nextxlogfile)
481480
pg_log(PG_REPORT," first WAL segment after reset\n");
482481

483-
if (!got_tli)
484-
pg_log(PG_REPORT," latest checkpoint timeline ID\n");
485-
486482
if (!got_align)
487483
pg_log(PG_REPORT," maximum alignment\n");
488484

@@ -568,6 +564,9 @@ check_control_data(ControlData *oldctrl,
568564
if (oldctrl->date_is_int!=newctrl->date_is_int)
569565
pg_fatal("old and new pg_controldata date/time storage types do not match\n");
570566

567+
if (oldctrl->float8_pass_by_value!=newctrl->float8_pass_by_value)
568+
pg_fatal("old and new pg_controldata float8 argument passing methods do not match\n");
569+
571570
/*
572571
* We might eventually allow upgrades from checksum to no-checksum
573572
* clusters.

‎src/bin/pg_upgrade/pg_upgrade.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ typedef struct
206206
uint32ctrl_ver;
207207
uint32cat_ver;
208208
charnextxlogfile[25];
209-
uint32chkpnt_tli;
210209
uint32chkpnt_nxtxid;
211210
uint32chkpnt_nxtepoch;
212211
uint32chkpnt_nxtoid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp