Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
6f8f8d2d
Commit
6f8f8d2d
authored
Jan 21, 2008
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide a clearer error message if the pg_control version number looks
wrong because of mismatched byte ordering.
parent
1e985720
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+12
-1
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_controldata/pg_controldata.c
+6
-1
No files found.
src/backend/access/transam/xlog.c
View file @
6f8f8d2d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.29
1 2008/01/01 19:45:48 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.29
2 2008/01/21 11:17:46 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -3888,6 +3888,16 @@ ReadControlFile(void)
...
@@ -3888,6 +3888,16 @@ ReadControlFile(void)
* of bytes. Complaining about wrong version will probably be more
* of bytes. Complaining about wrong version will probably be more
* enlightening than complaining about wrong CRC.
* 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
)
if
(
ControlFile
->
pg_control_version
!=
PG_CONTROL_VERSION
)
ereport
(
FATAL
,
ereport
(
FATAL
,
(
errmsg
(
"database files are incompatible with server"
),
(
errmsg
(
"database files are incompatible with server"
),
...
@@ -3895,6 +3905,7 @@ ReadControlFile(void)
...
@@ -3895,6 +3905,7 @@ ReadControlFile(void)
" but the server was compiled with PG_CONTROL_VERSION %d."
,
" but the server was compiled with PG_CONTROL_VERSION %d."
,
ControlFile
->
pg_control_version
,
PG_CONTROL_VERSION
),
ControlFile
->
pg_control_version
,
PG_CONTROL_VERSION
),
errhint
(
"It looks like you need to initdb."
)));
errhint
(
"It looks like you need to initdb."
)));
/* Now check the CRC. */
/* Now check the CRC. */
INIT_CRC32
(
crc
);
INIT_CRC32
(
crc
);
COMP_CRC32
(
crc
,
COMP_CRC32
(
crc
,
...
...
src/bin/pg_controldata/pg_controldata.c
View file @
6f8f8d2d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
* licence: BSD
* licence: BSD
*
*
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.3
5 2007/04/03 04:14:26 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.3
6 2008/01/21 11:17:46 petere
Exp $
*/
*/
#include "postgres.h"
#include "postgres.h"
...
@@ -151,6 +151,11 @@ main(int argc, char *argv[])
...
@@ -151,6 +151,11 @@ main(int argc, char *argv[])
printf
(
_
(
"pg_control version number: %u
\n
"
),
printf
(
_
(
"pg_control version number: %u
\n
"
),
ControlFile
.
pg_control_version
);
ControlFile
.
pg_control_version
);
if
(
ControlFile
.
pg_control_version
%
65536
==
0
&&
ControlFile
.
pg_control_version
/
65536
!=
0
)
printf
(
_
(
"WARNING: possible byte ordering mismatch
\n
"
"The byte ordering used to store the pg_control file might not match the one
\n
"
"used by this program. In that case the results below would be incorrect, and
\n
"
"the PostgreSQL installation would be incompatible with this data directory.
\n
"
));
printf
(
_
(
"Catalog version number: %u
\n
"
),
printf
(
_
(
"Catalog version number: %u
\n
"
),
ControlFile
.
catalog_version_no
);
ControlFile
.
catalog_version_no
);
printf
(
_
(
"Database system identifier: %s
\n
"
),
printf
(
_
(
"Database system identifier: %s
\n
"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment