On Tue, 2006-04-04 at 17:33 +0100, Simon Riggs wrote:
> On Tue, 2006-04-04 at 11:13 -0400, Tom Lane wrote:
> > Simon Riggs <[EMAIL PROTECTED]> writes:
> > > I see you've changed the control file back from XLOG_BLCKSZ to BLCKSZ; I
> > > wasn't sure which one of those to choose.
> >
> > Hm. The entire point of having a BLCKSZ-sized control file is to have
> > it *not* change in size across format revisions (see the comments) ...
> > which I suppose means that we really ought to have a hard-wired separate
> > constant, rather than depending on something that someone might want to
> > twiddle.
An additional patch enclosed that adds xlog blcksz onto the xlog long
header at the start of each xlog file, so we can cross-check between
file and system, as we do with xlog seg size.
(This is an *additional* patch, not a replacement one).
Best Regards, Simon Riggs
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.232
diff -c -r1.232 xlog.c
*** src/backend/access/transam/xlog.c 3 Apr 2006 23:35:03 -0000 1.232
--- src/backend/access/transam/xlog.c 4 Apr 2006 19:05:37 -0000
***************
*** 1265,1270 ****
--- 1265,1271 ----
NewLongPage->xlp_sysid = ControlFile->system_identifier;
NewLongPage->xlp_seg_size = XLogSegSize;
+ NewLongPage->xlp_xlog_blcksz = XLOG_BLCKSZ;
NewPage ->xlp_info |= XLP_LONG_HEADER;
Insert->currpos = ((char *) NewPage) +SizeOfXLogLongPHD;
***************
*** 2993,2998 ****
--- 2994,3006 ----
(errmsg("WAL file is from different system"),
errdetail("Incorrect XLOG_SEG_SIZE in page header.")));
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;
***************
*** 3839,3844 ****
--- 3847,3853 ----
longpage = (XLogLongPageHeader) page;
longpage->xlp_sysid = sysidentifier;
longpage->xlp_seg_size = XLogSegSize;
+ longpage->xlp_xlog_blcksz = XLOG_BLCKSZ;
/* Insert the initial checkpoint record */
record = (XLogRecord *) ((char *) page + SizeOfXLogLongPHD);
Index: src/include/access/xlog_internal.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/access/xlog_internal.h,v
retrieving revision 1.12
diff -c -r1.12 xlog_internal.h
*** src/include/access/xlog_internal.h 3 Apr 2006 23:35:04 -0000 1.12
--- src/include/access/xlog_internal.h 4 Apr 2006 19:05:48 -0000
***************
*** 93,98 ****
--- 93,99 ----
XLogPageHeaderData std; /* standard header fields */
uint64 xlp_sysid; /* system identifier from pg_control */
uint32 xlp_seg_size; /* just as a cross-check */
+ uint32 xlp_xlog_blcksz; /* just as a cross-check */
} XLogLongPageHeaderData;
#define SizeOfXLogLongPHD MAXALIGN(sizeof(XLogLongPageHeaderData))
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq