mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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.
This commit is contained in:
@ -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"),
|
||||
|
Reference in New Issue
Block a user