Re: includedir_internal headers are not self-contained

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Christoph Berg <cb(at)df7cb(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: includedir_internal headers are not self-contained
Date: 2014-04-30 11:18:07
Message-ID: 5360DBEF.6000102@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/29/2014 06:00 PM, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> On 04/29/2014 02:56 AM, Heikki Linnakangas wrote:
>>> On 04/28/2014 10:32 PM, Tom Lane wrote:
>>>> Meh. I still think it's a bad idea to have CATALOG_VERSION_NO getting
>>>> compiled into libpgcommon.a, where there will be no way to cross-check
>>>> that it matches anything. But I guess I'm losing this argument.
>
>>> FWIW, I agree it's a bad idea. I just have no better ideas (and
>>> haven't given it much thought anyway).
>
>> Sure sounds like a bad idea.
>
> One idea would be to have relpath.h/.c expose a function (not a #define)
> that returns the value of CATALOG_VERSION_NO compiled into it. Then,
> if pg_rewind were to replace all its direct references to
> CATALOG_VERSION_NO (including the value it checks against pg_control)
> with calls of that function, consistency would be ensured.

In pg_rewind, I'd like to compile CATALOG_VERSION_NO into the binary
itself, because pg_rewind is quite version-specific. Even if it happens
to work with libpgport from a different version, I would worry that
there are directory layout changes that would need to be handled in
pg_rewind for it to work safely. So I would like to lock it to a
specific catalog version.

To lock it down, I could call the function and check that it matches the
compiled-in value of CATALOG_VERSION_NO, though. So a function works for
me, even though I don't really need the flexibility.

> A notational problem is that if pg_rewind or similar program is directly
> using the TABLESPACE_VERSION_DIRECTORY macro anywhere, this wouldn't
> work. But we could perhaps expose a function to return that string too.

pg_rewind doesn't use TABLESPACE_VERSION_DIRECTORY directly.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-04-30 12:53:19 Re: Considerer Harmful Considered Harmful
Previous Message Heikki Linnakangas 2014-04-30 10:31:53 Re: Fix initdb for path with whitespace and at char