diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2008-01-21 11:17:46 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2008-01-21 11:17:46 +0000 |
commit | 6f8f8d2daaf7a46e6ca931dc9fa8cad4b6f7b7dd (patch) | |
tree | 16466ef93995e043bab2d1b93189d74bace03633 /src/backend/access/transam/xlog.c | |
parent | 1e985720ebd1a68ae3c64a660caebf72efca59c7 (diff) | |
download | postgresql-6f8f8d2daaf7a46e6ca931dc9fa8cad4b6f7b7dd.tar.gz postgresql-6f8f8d2daaf7a46e6ca931dc9fa8cad4b6f7b7dd.zip |
Provide a clearer error message if the pg_control version number looks
wrong because of mismatched byte ordering.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 165ed51c2ca..d2075018d96 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.291 2008/01/01 19:45:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.292 2008/01/21 11:17:46 petere Exp $ * *------------------------------------------------------------------------- */ @@ -3888,6 +3888,16 @@ ReadControlFile(void) * of bytes. Complaining about wrong version will probably be more * enlightening than complaining about wrong CRC. */ + + if (ControlFile->pg_control_version != PG_CONTROL_VERSION && ControlFile->pg_control_version % 65536 == 0 && ControlFile->pg_control_version / 65536 != 0) + ereport(FATAL, + (errmsg("database files are incompatible with server"), + errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x)," + " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).", + ControlFile->pg_control_version, ControlFile->pg_control_version, + PG_CONTROL_VERSION, PG_CONTROL_VERSION), + errhint("This could be a problem of mismatched byte ordering. It looks like you need to initdb."))); + if (ControlFile->pg_control_version != PG_CONTROL_VERSION) ereport(FATAL, (errmsg("database files are incompatible with server"), @@ -3895,6 +3905,7 @@ ReadControlFile(void) " but the server was compiled with PG_CONTROL_VERSION %d.", ControlFile->pg_control_version, PG_CONTROL_VERSION), errhint("It looks like you need to initdb."))); + /* Now check the CRC. */ INIT_CRC32(crc); COMP_CRC32(crc, |