Re: [HACKERS] pg_waldump's inclusion of backend headers is a mess

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [HACKERS] pg_waldump's inclusion of backend headers is a mess
Дата
Msg-id 20170214195414.52iy2wse2oft72be@alap3.anarazel.de
обсуждение исходный текст
Ответ на [HACKERS] pg_waldump's inclusion of backend headers is a mess  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] pg_waldump's inclusion of backend headers is a mess  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Hi,

On 2017-02-13 22:42:00 -0500, Robert Haas wrote:
> I dug into the problem and discovered that pg_waldump is slurping up a
> tremendous crapload of backend headers.  It includes gin.h,
> gist_private.h, hash_xlog.h, nbtree.h, and spgist.h, which all end up
> including amapi.h, which includes genam.h, which includes tidbitmap.h.

Right. Hard to avoid with the current organization - IIRC Alvaro, I (and
others?) had talked about doing more agressive reorganization first, but
the patch was already big enough...


> When you make tidbitmap.h include utils/dsa.h, it in turn includes
> port/atomics.h, which has an #error preventing frontend includes

Has to, because otherwise there's undefined variable/symbol references
on some, but not all, platforms.


> There are a number of ways to fix this problem; probably the cheapest
> available hack is to stick #ifndef FRONTEND around the additional
> stuff getting added to tidbitmap.h.  But that seems to be attacking
> the problem from the wrong end.

Agreed.


> Therefore, I proposed the attached patch, which splits spgxlog.h out
> of spgist_private.h, nbtxlog.h out of nbtree.h, gistxlog.h out of
> gist_private.h, and ginxlog.h and ginblock.h out of gin_private.h.
> These new header files are included by pg_waldump in lieu of the
> "private" versions.  This solves the immediate problem and I suspect
> it will head off future problems as well.
> 
> Thoughts, comments, objections, better ideas?

No better ideas.  I'm a bit concerned about declarations needed both by
normal and xlog related routines, but I guess that can be solved by a
third header as you did.


> +++ b/src/include/access/nbtxlog.h
> @@ -0,0 +1,255 @@
> +/*-------------------------------------------------------------------------
> + *
> + * nbtree.h
> + *      header file for postgres btree xlog routines

Wrong file name.


Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: [HACKERS] Official adoption of PGXN (was: removing tsearch2)
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] possibility to specify template database for pg_regress