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

Commit09b5271

Browse files
committed
Add a field to the first page of each WAL file to indicate the
XLOG_BLCKSZ. This ought to help in preventing configuration mismatchproblems if anyone tries to ship PITR files between servers compiledwith different XLOG_BLCKSZ settings. Simon Riggs
1 parente6140d9 commit09b5271

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.233 2006/04/04 22:39:59 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.234 2006/04/05 03:34:05 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1265,6 +1265,7 @@ AdvanceXLInsertBuffer(void)
12651265

12661266
NewLongPage->xlp_sysid=ControlFile->system_identifier;
12671267
NewLongPage->xlp_seg_size=XLogSegSize;
1268+
NewLongPage->xlp_xlog_blcksz=XLOG_BLCKSZ;
12681269
NewPage->xlp_info |=XLP_LONG_HEADER;
12691270

12701271
Insert->currpos= ((char*)NewPage)+SizeOfXLogLongPHD;
@@ -2994,6 +2995,13 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode)
29942995
errdetail("Incorrect XLOG_SEG_SIZE in page header.")));
29952996
return false;
29962997
}
2998+
if (longhdr->xlp_xlog_blcksz!=XLOG_BLCKSZ)
2999+
{
3000+
ereport(emode,
3001+
(errmsg("WAL file is from different system"),
3002+
errdetail("Incorrect XLOG_BLCKSZ in page header.")));
3003+
return false;
3004+
}
29973005
}
29983006
recaddr.xlogid=readId;
29993007
recaddr.xrecoff=readSeg*XLogSegSize+readOff;
@@ -3838,6 +3846,7 @@ BootStrapXLOG(void)
38383846
longpage= (XLogLongPageHeader)page;
38393847
longpage->xlp_sysid=sysidentifier;
38403848
longpage->xlp_seg_size=XLogSegSize;
3849+
longpage->xlp_xlog_blcksz=XLOG_BLCKSZ;
38413850

38423851
/* Insert the initial checkpoint record */
38433852
record= (XLogRecord*) ((char*)page+SizeOfXLogLongPHD);

‎src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.42 2006/04/04 22:39:59 tgl Exp $
26+
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.43 2006/04/05 03:34:05 tgl Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -723,6 +723,7 @@ WriteEmptyXLOG(void)
723723
longpage= (XLogLongPageHeader)page;
724724
longpage->xlp_sysid=ControlFile.system_identifier;
725725
longpage->xlp_seg_size=XLogSegSize;
726+
longpage->xlp_xlog_blcksz=XLOG_BLCKSZ;
726727

727728
/* Insert the initial checkpoint record */
728729
record= (XLogRecord*) ((char*)page+SizeOfXLogLongPHD);

‎src/include/access/xlog_internal.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.12 2006/04/03 23:35:04 tgl Exp $
14+
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.13 2006/04/05 03:34:05 tgl Exp $
1515
*/
1616
#ifndefXLOG_INTERNAL_H
1717
#defineXLOG_INTERNAL_H
@@ -69,7 +69,7 @@ typedef struct XLogContRecord
6969
/*
7070
* Each page of XLOG file has a header like this:
7171
*/
72-
#defineXLOG_PAGE_MAGIC0xD05D/* can be used as WAL version indicator */
72+
#defineXLOG_PAGE_MAGIC0xD05E/* can be used as WAL version indicator */
7373

7474
typedefstructXLogPageHeaderData
7575
{
@@ -93,6 +93,7 @@ typedef struct XLogLongPageHeaderData
9393
XLogPageHeaderDatastd;/* standard header fields */
9494
uint64xlp_sysid;/* system identifier from pg_control */
9595
uint32xlp_seg_size;/* just as a cross-check */
96+
uint32xlp_xlog_blcksz;/* just as a cross-check */
9697
}XLogLongPageHeaderData;
9798

9899
#defineSizeOfXLogLongPHDMAXALIGN(sizeof(XLogLongPageHeaderData))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp