diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 82e46bde50..20e63bea75 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,4 +1,4 @@ - + Operating System Environment @@ -1061,7 +1061,7 @@ set semsys:seminfo_semmsl=32 - 8200 (assuming 8K BLCKSZ) + 8200 (assuming 8K XLOG_BLCKSZ) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 4cf26cfaa7..a4ae78bcde 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.231 2006/03/31 23:32:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.232 2006/04/03 23:35:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -113,10 +113,10 @@ /* * Limitation of buffer-alignment for direct IO depends on OS and filesystem, - * but BLCKSZ is assumed to be enough for it. + * but XLOG_BLCKSZ is assumed to be enough for it. */ #ifdef O_DIRECT -#define ALIGNOF_XLOG_BUFFER BLCKSZ +#define ALIGNOF_XLOG_BUFFER XLOG_BLCKSZ #else #define ALIGNOF_XLOG_BUFFER ALIGNOF_BUFFER #endif @@ -374,7 +374,7 @@ typedef struct XLogCtlData * and xlblocks values depends on WALInsertLock and WALWriteLock. */ char *pages; /* buffers for unwritten XLOG pages */ - XLogRecPtr *xlblocks; /* 1st byte ptr-s + BLCKSZ */ + XLogRecPtr *xlblocks; /* 1st byte ptr-s + XLOG_BLCKSZ */ Size XLogCacheByte; /* # bytes in xlog buffers */ int XLogCacheBlck; /* highest allocated xlog buffer index */ TimeLineID ThisTimeLineID; @@ -397,7 +397,7 @@ static ControlFileData *ControlFile = NULL; /* Free space remaining in the current xlog page buffer */ #define INSERT_FREESPACE(Insert) \ - (BLCKSZ - ((Insert)->currpos - (char *) (Insert)->currpage)) + (XLOG_BLCKSZ - ((Insert)->currpos - (char *) (Insert)->currpage)) /* Construct XLogRecPtr value for current insertion point */ #define INSERT_RECPTR(recptr,Insert,curridx) \ @@ -441,7 +441,7 @@ static uint32 readId = 0; static uint32 readSeg = 0; static uint32 readOff = 0; -/* Buffer for currently read page (BLCKSZ bytes) */ +/* Buffer for currently read page (XLOG_BLCKSZ bytes) */ static char *readBuf = NULL; /* Buffer for current ReadRecord result (expandable) */ @@ -706,7 +706,7 @@ begin:; * If cache is half filled then try to acquire write lock and do * XLogWrite. Ignore any fractional blocks in performing this check. */ - LogwrtRqst.Write.xrecoff -= LogwrtRqst.Write.xrecoff % BLCKSZ; + LogwrtRqst.Write.xrecoff -= LogwrtRqst.Write.xrecoff % XLOG_BLCKSZ; if (LogwrtRqst.Write.xlogid != LogwrtResult.Write.xlogid || (LogwrtRqst.Write.xrecoff >= LogwrtResult.Write.xrecoff + XLogCtl->XLogCacheByte / 2)) @@ -1228,12 +1228,12 @@ AdvanceXLInsertBuffer(void) { /* crossing a logid boundary */ NewPageEndPtr.xlogid += 1; - NewPageEndPtr.xrecoff = BLCKSZ; + NewPageEndPtr.xrecoff = XLOG_BLCKSZ; } else - NewPageEndPtr.xrecoff += BLCKSZ; + NewPageEndPtr.xrecoff += XLOG_BLCKSZ; XLogCtl->xlblocks[nextidx] = NewPageEndPtr; - NewPage = (XLogPageHeader) (XLogCtl->pages + nextidx * (Size) BLCKSZ); + NewPage = (XLogPageHeader) (XLogCtl->pages + nextidx * (Size) XLOG_BLCKSZ); Insert->curridx = nextidx; Insert->currpage = NewPage; @@ -1244,7 +1244,7 @@ AdvanceXLInsertBuffer(void) * Be sure to re-zero the buffer so that bytes beyond what we've written * will look like zeroes and not valid XLOG records... */ - MemSet((char *) NewPage, 0, BLCKSZ); + MemSet((char *) NewPage, 0, XLOG_BLCKSZ); /* * Fill the new page's header @@ -1254,7 +1254,7 @@ AdvanceXLInsertBuffer(void) /* NewPage->xlp_info = 0; */ /* done by memset */ NewPage ->xlp_tli = ThisTimeLineID; NewPage ->xlp_pageaddr.xlogid = NewPageEndPtr.xlogid; - NewPage ->xlp_pageaddr.xrecoff = NewPageEndPtr.xrecoff - BLCKSZ; + NewPage ->xlp_pageaddr.xrecoff = NewPageEndPtr.xrecoff - XLOG_BLCKSZ; /* * If first page of an XLOG segment file, make it a long header. @@ -1428,7 +1428,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) { /* first of group */ startidx = curridx; - startoffset = (LogwrtResult.Write.xrecoff - BLCKSZ) % XLogSegSize; + startoffset = (LogwrtResult.Write.xrecoff - XLOG_BLCKSZ) % XLogSegSize; } npages++; @@ -1439,7 +1439,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) * segment. */ finishing_seg = !ispartialpage && - (startoffset + npages * BLCKSZ) >= XLogSegSize; + (startoffset + npages * XLOG_BLCKSZ) >= XLogSegSize; if (!XLByteLT(LogwrtResult.Write, WriteRqst.Write) || curridx == XLogCtl->XLogCacheBlck || @@ -1461,8 +1461,8 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) } /* OK to write the page(s) */ - from = XLogCtl->pages + startidx * (Size) BLCKSZ; - nbytes = npages * (Size) BLCKSZ; + from = XLogCtl->pages + startidx * (Size) XLOG_BLCKSZ; + nbytes = npages * (Size) XLOG_BLCKSZ; errno = 0; if (write(openLogFile, from, nbytes) != nbytes) { @@ -1720,7 +1720,7 @@ XLogFileInit(uint32 log, uint32 seg, { char path[MAXPGPATH]; char tmppath[MAXPGPATH]; - char zbuffer[BLCKSZ]; + char zbuffer[XLOG_BLCKSZ]; uint32 installed_log; uint32 installed_seg; int max_advance; @@ -1858,7 +1858,7 @@ XLogFileCopy(uint32 log, uint32 seg, { char path[MAXPGPATH]; char tmppath[MAXPGPATH]; - char buffer[BLCKSZ]; + char buffer[XLOG_BLCKSZ]; int srcfd; int fd; int nbytes; @@ -2637,7 +2637,7 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) * (2) a static char array isn't guaranteed to have any particular * alignment, whereas malloc() will provide MAXALIGN'd storage. */ - readBuf = (char *) malloc(BLCKSZ); + readBuf = (char *) malloc(XLOG_BLCKSZ); Assert(readBuf != NULL); } @@ -2651,8 +2651,8 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) goto got_record; } /* align old recptr to next page */ - if (tmpRecPtr.xrecoff % BLCKSZ != 0) - tmpRecPtr.xrecoff += (BLCKSZ - tmpRecPtr.xrecoff % BLCKSZ); + if (tmpRecPtr.xrecoff % XLOG_BLCKSZ != 0) + tmpRecPtr.xrecoff += (XLOG_BLCKSZ - tmpRecPtr.xrecoff % XLOG_BLCKSZ); if (tmpRecPtr.xrecoff >= XLogFileSize) { (tmpRecPtr.xlogid)++; @@ -2696,7 +2696,7 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) readOff = (uint32) (-1); /* force read to occur below */ } - targetPageOff = ((RecPtr->xrecoff % XLogSegSize) / BLCKSZ) * BLCKSZ; + targetPageOff = ((RecPtr->xrecoff % XLogSegSize) / XLOG_BLCKSZ) * XLOG_BLCKSZ; if (readOff != targetPageOff) { readOff = targetPageOff; @@ -2708,7 +2708,7 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) readId, readSeg, readOff))); goto next_record_is_invalid; } - if (read(readFile, readBuf, BLCKSZ) != BLCKSZ) + if (read(readFile, readBuf, XLOG_BLCKSZ) != XLOG_BLCKSZ) { ereport(emode, (errcode_for_file_access(), @@ -2720,7 +2720,7 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) goto next_record_is_invalid; } pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf); - targetRecOff = RecPtr->xrecoff % BLCKSZ; + targetRecOff = RecPtr->xrecoff % XLOG_BLCKSZ; if (targetRecOff == 0) { /* @@ -2746,7 +2746,7 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) RecPtr->xlogid, RecPtr->xrecoff))); goto next_record_is_invalid; } - record = (XLogRecord *) ((char *) readBuf + RecPtr->xrecoff % BLCKSZ); + record = (XLogRecord *) ((char *) readBuf + RecPtr->xrecoff % XLOG_BLCKSZ); got_record:; @@ -2811,17 +2811,18 @@ got_record:; /* * Allocate or enlarge readRecordBuf as needed. To avoid useless small - * increases, round its size to a multiple of BLCKSZ, and make sure it's - * at least 4*BLCKSZ to start with. (That is enough for all "normal" - * records, but very large commit or abort records might need more space.) + * increases, round its size to a multiple of XLOG_BLCKSZ, and make sure + * it's at least 4*Max(BLCKSZ, XLOG_BLCKSZ) to start with. (That is + * enough for all "normal" records, but very large commit or abort records + * might need more space.) */ total_len = record->xl_tot_len; if (total_len > readRecordBufSize) { uint32 newSize = total_len; - newSize += BLCKSZ - (newSize % BLCKSZ); - newSize = Max(newSize, 4 * BLCKSZ); + newSize += XLOG_BLCKSZ - (newSize % XLOG_BLCKSZ); + newSize = Max(newSize, 4 * Max(BLCKSZ, XLOG_BLCKSZ)); if (readRecordBuf) free(readRecordBuf); readRecordBuf = (char *) malloc(newSize); @@ -2839,7 +2840,7 @@ got_record:; buffer = readRecordBuf; nextRecord = NULL; - len = BLCKSZ - RecPtr->xrecoff % BLCKSZ; + len = XLOG_BLCKSZ - RecPtr->xrecoff % XLOG_BLCKSZ; if (total_len > len) { /* Need to reassemble record */ @@ -2851,7 +2852,7 @@ got_record:; buffer += len; for (;;) { - readOff += BLCKSZ; + readOff += XLOG_BLCKSZ; if (readOff >= XLogSegSize) { close(readFile); @@ -2862,7 +2863,7 @@ got_record:; goto next_record_is_invalid; readOff = 0; } - if (read(readFile, readBuf, BLCKSZ) != BLCKSZ) + if (read(readFile, readBuf, XLOG_BLCKSZ) != XLOG_BLCKSZ) { ereport(emode, (errcode_for_file_access(), @@ -2890,7 +2891,7 @@ got_record:; readId, readSeg, readOff))); goto next_record_is_invalid; } - len = BLCKSZ - pageHeaderSize - SizeOfXLogContRecord; + len = XLOG_BLCKSZ - pageHeaderSize - SizeOfXLogContRecord; if (contrecord->xl_rem_len > len) { memcpy(buffer, (char *) contrecord + SizeOfXLogContRecord, len); @@ -2905,7 +2906,7 @@ got_record:; if (!RecordIsValid(record, *RecPtr, emode)) goto next_record_is_invalid; pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf); - if (BLCKSZ - SizeOfXLogRecord >= pageHeaderSize + + if (XLOG_BLCKSZ - SizeOfXLogRecord >= pageHeaderSize + MAXALIGN(SizeOfXLogContRecord + contrecord->xl_rem_len)) { nextRecord = (XLogRecord *) ((char *) contrecord + @@ -2922,7 +2923,7 @@ got_record:; /* Record does not cross a page boundary */ if (!RecordIsValid(record, *RecPtr, emode)) goto next_record_is_invalid; - if (BLCKSZ - SizeOfXLogRecord >= RecPtr->xrecoff % BLCKSZ + + if (XLOG_BLCKSZ - SizeOfXLogRecord >= RecPtr->xrecoff % XLOG_BLCKSZ + MAXALIGN(total_len)) nextRecord = (XLogRecord *) ((char *) record + MAXALIGN(total_len)); EndRecPtr.xlogid = RecPtr->xlogid; @@ -3404,6 +3405,7 @@ WriteControlFile(void) ControlFile->blcksz = BLCKSZ; ControlFile->relseg_size = RELSEG_SIZE; + ControlFile->xlog_blcksz = XLOG_BLCKSZ; ControlFile->xlog_seg_size = XLOG_SEG_SIZE; ControlFile->nameDataLen = NAMEDATALEN; @@ -3572,6 +3574,13 @@ ReadControlFile(void) " but the server was compiled with RELSEG_SIZE %d.", ControlFile->relseg_size, RELSEG_SIZE), errhint("It looks like you need to recompile or initdb."))); + if (ControlFile->xlog_blcksz != XLOG_BLCKSZ) + ereport(FATAL, + (errmsg("database files are incompatible with server"), + errdetail("The database cluster was initialized with XLOG_BLCKSZ %d," + " but the server was compiled with XLOG_BLCKSZ %d.", + ControlFile->xlog_blcksz, XLOG_BLCKSZ), + errhint("It looks like you need to recompile or initdb."))); if (ControlFile->xlog_seg_size != XLOG_SEG_SIZE) ereport(FATAL, (errmsg("database files are incompatible with server"), @@ -3696,7 +3705,7 @@ XLOGShmemSize(void) /* extra alignment padding for XLOG I/O buffers */ size = add_size(size, ALIGNOF_XLOG_BUFFER); /* and the buffers themselves */ - size = add_size(size, mul_size(BLCKSZ, XLOGbuffers)); + size = add_size(size, mul_size(XLOG_BLCKSZ, XLOGbuffers)); /* * Note: we don't count ControlFileData, it comes out of the "slop factor" @@ -3743,13 +3752,13 @@ XLOGShmemInit(void) */ allocptr = (char *) TYPEALIGN(ALIGNOF_XLOG_BUFFER, allocptr); XLogCtl->pages = allocptr; - memset(XLogCtl->pages, 0, (Size) BLCKSZ * XLOGbuffers); + memset(XLogCtl->pages, 0, (Size) XLOG_BLCKSZ * XLOGbuffers); /* * Do basic initialization of XLogCtl shared data. (StartupXLOG will fill * in additional info.) */ - XLogCtl->XLogCacheByte = (Size) BLCKSZ *XLOGbuffers; + XLogCtl->XLogCacheByte = (Size) XLOG_BLCKSZ * XLOGbuffers; XLogCtl->XLogCacheBlck = XLOGbuffers - 1; XLogCtl->Insert.currpage = (XLogPageHeader) (XLogCtl->pages); @@ -3801,9 +3810,9 @@ BootStrapXLOG(void) ThisTimeLineID = 1; /* page buffer must be aligned suitably for O_DIRECT */ - buffer = (char *) palloc(BLCKSZ + ALIGNOF_XLOG_BUFFER); + buffer = (char *) palloc(XLOG_BLCKSZ + ALIGNOF_XLOG_BUFFER); page = (XLogPageHeader) TYPEALIGN(ALIGNOF_XLOG_BUFFER, buffer); - memset(page, 0, BLCKSZ); + memset(page, 0, XLOG_BLCKSZ); /* Set up information for the initial checkpoint record */ checkPoint.redo.xlogid = 0; @@ -3855,7 +3864,7 @@ BootStrapXLOG(void) /* Write the first page with the initial record */ errno = 0; - if (write(openLogFile, page, BLCKSZ) != BLCKSZ) + if (write(openLogFile, page, XLOG_BLCKSZ) != XLOG_BLCKSZ) { /* if write didn't set errno, assume problem is no disk space */ if (errno == 0) @@ -4712,17 +4721,17 @@ StartupXLOG(void) Insert->PrevRecord = LastRec; XLogCtl->xlblocks[0].xlogid = openLogId; XLogCtl->xlblocks[0].xrecoff = - ((EndOfLog.xrecoff - 1) / BLCKSZ + 1) * BLCKSZ; + ((EndOfLog.xrecoff - 1) / XLOG_BLCKSZ + 1) * XLOG_BLCKSZ; /* * Tricky point here: readBuf contains the *last* block that the LastRec * record spans, not the one it starts in. The last block is indeed the * one we want to use. */ - Assert(readOff == (XLogCtl->xlblocks[0].xrecoff - BLCKSZ) % XLogSegSize); - memcpy((char *) Insert->currpage, readBuf, BLCKSZ); + Assert(readOff == (XLogCtl->xlblocks[0].xrecoff - XLOG_BLCKSZ) % XLogSegSize); + memcpy((char *) Insert->currpage, readBuf, XLOG_BLCKSZ); Insert->currpos = (char *) Insert->currpage + - (EndOfLog.xrecoff + BLCKSZ - XLogCtl->xlblocks[0].xrecoff); + (EndOfLog.xrecoff + XLOG_BLCKSZ - XLogCtl->xlblocks[0].xrecoff); LogwrtResult.Write = LogwrtResult.Flush = EndOfLog; diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index 4e9a9afa0e..b2d0e01e02 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -6,7 +6,7 @@ * copyright (c) Oliver Elphick , 2001; * licence: BSD * - * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.27 2005/10/15 02:49:37 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.28 2006/04/03 23:35:04 tgl Exp $ */ #include "postgres.h" @@ -172,6 +172,7 @@ main(int argc, char *argv[]) /* we don't print floatFormat since can't say much useful about it */ printf(_("Database block size: %u\n"), ControlFile.blcksz); printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size); + printf(_("WAL block size: %u\n"), ControlFile.xlog_blcksz); printf(_("Bytes per WAL segment: %u\n"), ControlFile.xlog_seg_size); printf(_("Maximum length of identifiers: %u\n"), ControlFile.nameDataLen); printf(_("Maximum columns in an index: %u\n"), ControlFile.indexMaxKeys); diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index 7b14ad9a26..c680ecdbb2 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -23,7 +23,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.40 2006/03/05 15:58:51 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.41 2006/04/03 23:35:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -457,6 +457,7 @@ GuessControlValues(void) ControlFile.floatFormat = FLOATFORMAT_VALUE; ControlFile.blcksz = BLCKSZ; ControlFile.relseg_size = RELSEG_SIZE; + ControlFile.xlog_blcksz = XLOG_BLCKSZ; ControlFile.xlog_seg_size = XLOG_SEG_SIZE; ControlFile.nameDataLen = NAMEDATALEN; ControlFile.indexMaxKeys = INDEX_MAX_KEYS; @@ -526,6 +527,8 @@ PrintControlValues(bool guessed) /* we don't print floatFormat since can't say much useful about it */ printf(_("Database block size: %u\n"), ControlFile.blcksz); printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size); + printf(_("WAL block size: %u\n"), ControlFile.xlog_blcksz); + printf(_("Bytes per WAL segment: %u\n"), ControlFile.xlog_seg_size); printf(_("Maximum length of identifiers: %u\n"), ControlFile.nameDataLen); printf(_("Maximum columns in an index: %u\n"), ControlFile.indexMaxKeys); printf(_("Date/time type storage: %s\n"), @@ -705,9 +708,9 @@ WriteEmptyXLOG(void) int nbytes; /* Use malloc() to ensure buffer is MAXALIGNED */ - buffer = (char *) malloc(BLCKSZ); + buffer = (char *) malloc(XLOG_BLCKSZ); page = (XLogPageHeader) buffer; - memset(buffer, 0, BLCKSZ); + memset(buffer, 0, XLOG_BLCKSZ); /* Set up the XLOG page header */ page->xlp_magic = XLOG_PAGE_MAGIC; @@ -756,7 +759,7 @@ WriteEmptyXLOG(void) } errno = 0; - if (write(fd, buffer, BLCKSZ) != BLCKSZ) + if (write(fd, buffer, XLOG_BLCKSZ) != XLOG_BLCKSZ) { /* if write didn't set errno, assume problem is no disk space */ if (errno == 0) @@ -767,11 +770,11 @@ WriteEmptyXLOG(void) } /* Fill the rest of the file with zeroes */ - memset(buffer, 0, BLCKSZ); - for (nbytes = BLCKSZ; nbytes < XLogSegSize; nbytes += BLCKSZ) + memset(buffer, 0, XLOG_BLCKSZ); + for (nbytes = XLOG_BLCKSZ; nbytes < XLogSegSize; nbytes += XLOG_BLCKSZ) { errno = 0; - if (write(fd, buffer, BLCKSZ) != BLCKSZ) + if (write(fd, buffer, XLOG_BLCKSZ) != XLOG_BLCKSZ) { if (errno == 0) errno = ENOSPC; diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 9bf46c2831..6fbda53f39 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.11 2006/03/24 04:32:13 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.12 2006/04/03 23:35:04 tgl Exp $ */ #ifndef XLOG_INTERNAL_H #define XLOG_INTERNAL_H @@ -182,8 +182,8 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; /* Check if an xrecoff value is in a plausible range */ #define XRecOffIsValid(xrecoff) \ - ((xrecoff) % BLCKSZ >= SizeOfXLogShortPHD && \ - (BLCKSZ - (xrecoff) % BLCKSZ) >= SizeOfXLogRecord) + ((xrecoff) % XLOG_BLCKSZ >= SizeOfXLogShortPHD && \ + (XLOG_BLCKSZ - (xrecoff) % XLOG_BLCKSZ) >= SizeOfXLogRecord) /* * The XLog directory and control file (relative to $PGDATA) diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index a1b123bd37..ba54fdc8e6 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.27 2006/03/05 15:58:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.28 2006/04/03 23:35:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ /* Version identifier for this pg_control format */ -#define PG_CONTROL_VERSION 812 +#define PG_CONTROL_VERSION 820 /* * Body of CheckPoint XLOG records. This is declared here because we keep @@ -126,9 +126,10 @@ typedef struct ControlFileData * This data is used to make sure that configuration of this database is * compatible with the backend executable. */ - uint32 blcksz; /* block size for this DB */ + uint32 blcksz; /* data block size for this DB */ uint32 relseg_size; /* blocks per segment of large relation */ + uint32 xlog_blcksz; /* block size within WAL files */ uint32 xlog_seg_size; /* size of each WAL segment */ uint32 nameDataLen; /* catalog name field width */ diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index a5170b5f22..e41b11e831 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -6,7 +6,7 @@ * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * - * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.20 2006/01/05 03:01:37 momjian Exp $ + * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.21 2006/04/03 23:35:05 tgl Exp $ *------------------------------------------------------------------------ */ @@ -43,9 +43,20 @@ */ #define RELSEG_SIZE (0x40000000 / BLCKSZ) +/* + * Size of a WAL file block. This need have no particular relation to BLCKSZ. + * XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O, + * XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O + * buffers, else direct I/O may fail. + * + * Changing XLOG_BLCKSZ requires an initdb. + */ +#define XLOG_BLCKSZ 8192 + /* * XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2 - * and larger than BLCKSZ (preferably, a great deal larger than BLCKSZ). + * and larger than XLOG_BLCKSZ (preferably, a great deal larger than + * XLOG_BLCKSZ). * * Changing XLOG_SEG_SIZE requires an initdb. */