Problem with ControlFileData structure being ABI dependent

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Problem with ControlFileData structure being ABI dependent
Date: 2007-12-06 14:19:42
Message-ID: 877ijrx5vl.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


In trying to run a benchmark comparing mingw with VC++ builds Dave discovered
that if you initdb with one and try to run with the other you get a message
saying "incorrect checksum in control file" rather than the more appropriate
and friendly "database files are incompatible with server".

This is because of (at least) two changes in the ABI between the runtimes used
by mingw and VC++. 1) Enums are apparently 8 bytes on VC++ but 4 bytes on
mingw and 2) time_t is 8 bytes on VC++ but 4 bytes on mingw.

To get the right message we could add the size of the control file (or
offsetof(crc)) to the control file itself near the top and check it before the
checksum. That would be an initdb though which would be annoying at this
point. I think we should do this at the next opportunity though.

But I'm a bit concerned about change in ABI between mingw and VC++. I thought
these two used the same ABI. Are we sure Slony et al don't use time_t or enums
or anything else which may have changed between these two runtimes?

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2007-12-06 14:30:41 Re: Problem with ControlFileData structure being ABI dependent
Previous Message Manolo _ 2007-12-06 14:11:56 Compiling PG on linux