Re: Problem with server/utils/snapmgr.h - Mailing list pgsql-hackers

From Chris Browne
Subject Re: Problem with server/utils/snapmgr.h
Date
Msg-id 60tzhulyr1.fsf@dba2.int.libertyrms.com
Whole thread Raw
In response to Problem with server/utils/snapmgr.h  (Chris Browne <cbbrowne@acm.org>)
Responses Re: Problem with server/utils/snapmgr.h  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
alvherre@commandprompt.com (Alvaro Herrera) writes:

> Chris Browne wrote:
>
>> If I use:
>>   AC_CHECK_HEADER(utils/snapmgr.h, HAVE_SNAPMGR=1)
>> 
>> this turns out to fail.  Apparently autoconf wants to compile the
>> #include file to validate that it's an OK #include file.
>> 
>> GCC barfs on it, thus:
>> 
>> cbbrowne@dba2:~/Slony-I/CMD/slony1-HEAD> gcc -I/opt/OXRS/dbs/pgsql84-beta/include/server
/opt/OXRS/dbs/pgsql84-beta/include/server/utils/snapmgr.h
>> In file included from /opt/OXRS/dbs/pgsql84-beta/include/server/storage/itemptr.h:17,
>>                  from /opt/OXRS/dbs/pgsql84-beta/include/server/access/htup.h:17,
>>                  from /opt/OXRS/dbs/pgsql84-beta/include/server/utils/snapshot.h:16,
>>                  from /opt/OXRS/dbs/pgsql84-beta/include/server/utils/tqual.h:18,
>>                  from /opt/OXRS/dbs/pgsql84-beta/include/server/utils/snapmgr.h:16:
>
>
> Hmm.  It works for me if I forcefully include postgres.h:
>
> gcc -I/pgsql/install/00head/include/server -include postgres.h /pgsql/install/00head/include/server/utils/snapmgr.h 
>
> Our header file rule says that a header must include any header it needs
> to compile, but never include postgres.h, which must be the first
> include in all the .c files.
>
> So I'm not sure the fix for this.
>
> What does Slony-I need snapmgr.h for, anyway?  This code is in a state
> of a flux right now -- there are pending patches which are likely to
> change the horizon a bit.  Perhaps it does not make sense for Slony to
> adjust to a state that's expected to be short-lived.

Well, one of the Sun guys observed this...
http://www.slony.info/bugzilla/show_bug.cgi?id=46

And I was trying to build against CVS HEAD (for both projects ;-)) and
observed it:

cbbrowne@dba2:CMD/slony1-HEAD/src/backend> make
gcc -g -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../.. -fpic -I/opt/OXRS/dbs/pgsql84-beta/include/
-I/opt/OXRS/dbs/pgsql84-beta/include/server/ -c -o slony1_funcs.o slony1_funcs.c
 
slony1_funcs.c: In function '_Slony_I_createEvent':
slony1_funcs.c:142: error: 'SerializableSnapshot' undeclared (first use in this function)
slony1_funcs.c:142: error: (Each undeclared identifier is reported only once
slony1_funcs.c:142: error: for each function it appears in.)

The definition for SerializableSnapshot has moved from
server/utils/tqual.h to server/utils/snapmgr.h

I agree that the code seems in flux; it seems quite likely that there
will be further changes between now and release of 8.4.  That being
said, it's useful to observe these problems *early*, and have
workarounds, so that we can validate that Slony-I is generally
compatible with 8.4 throughout its development cycle.

As a workaround, for now, I'll see if Tom's counsel on this works out
well; I expect so.

The point of the exercise wasn't so much to ask "How do I work around
this?" as it was to point out that there's *something* up with the
header file, in that the autoconf AC_CHECK_HEADER function barfs on
it.

*THAT* (the fact that AC_CHECK_HEADER breaks) appears to be a bad
thing, irrespective of any Slony-I issues.
-- 
let name="cbbrowne" and tld="linuxdatabases.info" in name ^ "@" ^ tld;;
http://linuxdatabases.info/info/x.html
Signs of   a Klingon Programmer -   1.  "Defensive  programming? Never!
Klingon programs are always on the offense. Yes, offensive programming
is what we do best."


pgsql-hackers by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: TRUNCATE TABLE with IDENTITY
Next
From: Alvaro Herrera
Date:
Subject: Re: Problem with server/utils/snapmgr.h