Add a field to the first page of each WAL file to indicate the
XLOG_BLCKSZ. This ought to help in preventing configuration mismatch problems if anyone tries to ship PITR files between servers compiled with different XLOG_BLCKSZ settings. Simon Riggs
This commit is contained in:
parent
e6140d9052
commit
09b5271ebd
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.233 2006/04/04 22:39:59 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.234 2006/04/05 03:34:05 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1265,6 +1265,7 @@ AdvanceXLInsertBuffer(void)
|
|||||||
|
|
||||||
NewLongPage->xlp_sysid = ControlFile->system_identifier;
|
NewLongPage->xlp_sysid = ControlFile->system_identifier;
|
||||||
NewLongPage->xlp_seg_size = XLogSegSize;
|
NewLongPage->xlp_seg_size = XLogSegSize;
|
||||||
|
NewLongPage->xlp_xlog_blcksz = XLOG_BLCKSZ;
|
||||||
NewPage ->xlp_info |= XLP_LONG_HEADER;
|
NewPage ->xlp_info |= XLP_LONG_HEADER;
|
||||||
|
|
||||||
Insert->currpos = ((char *) NewPage) +SizeOfXLogLongPHD;
|
Insert->currpos = ((char *) NewPage) +SizeOfXLogLongPHD;
|
||||||
@ -2994,6 +2995,13 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode)
|
|||||||
errdetail("Incorrect XLOG_SEG_SIZE in page header.")));
|
errdetail("Incorrect XLOG_SEG_SIZE in page header.")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (longhdr->xlp_xlog_blcksz != XLOG_BLCKSZ)
|
||||||
|
{
|
||||||
|
ereport(emode,
|
||||||
|
(errmsg("WAL file is from different system"),
|
||||||
|
errdetail("Incorrect XLOG_BLCKSZ in page header.")));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
recaddr.xlogid = readId;
|
recaddr.xlogid = readId;
|
||||||
recaddr.xrecoff = readSeg * XLogSegSize + readOff;
|
recaddr.xrecoff = readSeg * XLogSegSize + readOff;
|
||||||
@ -3838,6 +3846,7 @@ BootStrapXLOG(void)
|
|||||||
longpage = (XLogLongPageHeader) page;
|
longpage = (XLogLongPageHeader) page;
|
||||||
longpage->xlp_sysid = sysidentifier;
|
longpage->xlp_sysid = sysidentifier;
|
||||||
longpage->xlp_seg_size = XLogSegSize;
|
longpage->xlp_seg_size = XLogSegSize;
|
||||||
|
longpage->xlp_xlog_blcksz = XLOG_BLCKSZ;
|
||||||
|
|
||||||
/* Insert the initial checkpoint record */
|
/* Insert the initial checkpoint record */
|
||||||
record = (XLogRecord *) ((char *) page + SizeOfXLogLongPHD);
|
record = (XLogRecord *) ((char *) page + SizeOfXLogLongPHD);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.42 2006/04/04 22:39:59 tgl Exp $
|
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.43 2006/04/05 03:34:05 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -723,6 +723,7 @@ WriteEmptyXLOG(void)
|
|||||||
longpage = (XLogLongPageHeader) page;
|
longpage = (XLogLongPageHeader) page;
|
||||||
longpage->xlp_sysid = ControlFile.system_identifier;
|
longpage->xlp_sysid = ControlFile.system_identifier;
|
||||||
longpage->xlp_seg_size = XLogSegSize;
|
longpage->xlp_seg_size = XLogSegSize;
|
||||||
|
longpage->xlp_xlog_blcksz = XLOG_BLCKSZ;
|
||||||
|
|
||||||
/* Insert the initial checkpoint record */
|
/* Insert the initial checkpoint record */
|
||||||
record = (XLogRecord *) ((char *) page + SizeOfXLogLongPHD);
|
record = (XLogRecord *) ((char *) page + SizeOfXLogLongPHD);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.12 2006/04/03 23:35:04 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.13 2006/04/05 03:34:05 tgl Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef XLOG_INTERNAL_H
|
#ifndef XLOG_INTERNAL_H
|
||||||
#define XLOG_INTERNAL_H
|
#define XLOG_INTERNAL_H
|
||||||
@ -69,7 +69,7 @@ typedef struct XLogContRecord
|
|||||||
/*
|
/*
|
||||||
* Each page of XLOG file has a header like this:
|
* Each page of XLOG file has a header like this:
|
||||||
*/
|
*/
|
||||||
#define XLOG_PAGE_MAGIC 0xD05D /* can be used as WAL version indicator */
|
#define XLOG_PAGE_MAGIC 0xD05E /* can be used as WAL version indicator */
|
||||||
|
|
||||||
typedef struct XLogPageHeaderData
|
typedef struct XLogPageHeaderData
|
||||||
{
|
{
|
||||||
@ -93,6 +93,7 @@ typedef struct XLogLongPageHeaderData
|
|||||||
XLogPageHeaderData std; /* standard header fields */
|
XLogPageHeaderData std; /* standard header fields */
|
||||||
uint64 xlp_sysid; /* system identifier from pg_control */
|
uint64 xlp_sysid; /* system identifier from pg_control */
|
||||||
uint32 xlp_seg_size; /* just as a cross-check */
|
uint32 xlp_seg_size; /* just as a cross-check */
|
||||||
|
uint32 xlp_xlog_blcksz; /* just as a cross-check */
|
||||||
} XLogLongPageHeaderData;
|
} XLogLongPageHeaderData;
|
||||||
|
|
||||||
#define SizeOfXLogLongPHD MAXALIGN(sizeof(XLogLongPageHeaderData))
|
#define SizeOfXLogLongPHD MAXALIGN(sizeof(XLogLongPageHeaderData))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user