aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-10-03 00:28:43 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-10-03 00:28:43 +0000
commit64eea6c21d5ad64753f3564862572951f80d5c92 (patch)
tree88785cda0f8c110af9a8067ff1dc6141e8eb4f89 /src/backend/access/transam/xlog.c
parentaa731ed8433914641e42f32fec0fcf27f01aab7e (diff)
downloadpostgresql-64eea6c21d5ad64753f3564862572951f80d5c92.tar.gz
postgresql-64eea6c21d5ad64753f3564862572951f80d5c92.zip
Expand pg_control information so that we can verify that the database
was created on a machine with alignment rules and floating-point format similar to the current machine. Per recent discussion, this seems like a good idea with the increasing prevalence of 32/64 bit environments.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 14490a918e7..878d7e21efc 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.218 2005/08/22 23:59:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.219 2005/10/03 00:28:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3417,6 +3417,10 @@ WriteControlFile(void)
*/
ControlFile->pg_control_version = PG_CONTROL_VERSION;
ControlFile->catalog_version_no = CATALOG_VERSION_NO;
+
+ ControlFile->maxAlign = MAXIMUM_ALIGNOF;
+ ControlFile->floatFormat = FLOATFORMAT_VALUE;
+
ControlFile->blcksz = BLCKSZ;
ControlFile->relseg_size = RELSEG_SIZE;
ControlFile->xlog_seg_size = XLOG_SEG_SIZE;
@@ -3562,6 +3566,18 @@ ReadControlFile(void)
" but the server was compiled with CATALOG_VERSION_NO %d.",
ControlFile->catalog_version_no, CATALOG_VERSION_NO),
errhint("It looks like you need to initdb.")));
+ if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
+ ereport(FATAL,
+ (errmsg("database files are incompatible with server"),
+ errdetail("The database cluster was initialized with MAXALIGN %d,"
+ " but the server was compiled with MAXALIGN %d.",
+ ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+ errhint("It looks like you need to initdb.")));
+ if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
+ ereport(FATAL,
+ (errmsg("database files are incompatible with server"),
+ errdetail("The database cluster appears to use a different floating-point format than the server executable."),
+ errhint("It looks like you need to initdb.")));
if (ControlFile->blcksz != BLCKSZ)
ereport(FATAL,
(errmsg("database files are incompatible with server"),