Обсуждение: pgsql: Clean up the #include mess a little.

Поиск
Список
Период
Сортировка

pgsql: Clean up the #include mess a little.

От
Tom Lane
Дата:
Clean up the #include mess a little.

walsender.h should depend on xlog.h, not vice versa.  (Actually, the
inclusion was circular until a couple hours ago, which was even sillier;
but Bruce broke it in the expedient rather than logically correct
direction.)  Because of that poor decision, plus blind application of
pgrminclude, we had a situation where half the system was depending on
xlog.h to include such unrelated stuff as array.h and guc.h.  Clean up
the header inclusion, and manually revert a lot of what pgrminclude had
done so things build again.

This episode reinforces my feeling that pgrminclude should not be run
without adult supervision.  Inclusion changes in header files in particular
need to be reviewed with great care.  More generally, it'd be good if we
had a clearer notion of module layering to dictate which headers can sanely
include which others ... but that's a big task for another day.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/1609797c25f6b440371045039733d69fe8cb9410

Modified Files
--------------
contrib/auto_explain/auto_explain.c             |    1 +
contrib/cube/cube.c                             |    1 +
contrib/pg_stat_statements/pg_stat_statements.c |    1 +
contrib/tsearch2/tsearch2.c                     |    1 +
src/backend/access/common/reloptions.c          |    2 ++
src/backend/access/gin/ginarrayproc.c           |    1 +
src/backend/access/transam/slru.c               |    1 +
src/backend/access/transam/twophase_rmgr.c      |    1 +
src/backend/access/transam/varsup.c             |    1 +
src/backend/access/transam/xact.c               |    3 +++
src/backend/access/transam/xlogutils.c          |    2 ++
src/backend/bootstrap/bootstrap.c               |    1 +
src/backend/catalog/dependency.c                |    1 +
src/backend/catalog/index.c                     |    1 +
src/backend/catalog/namespace.c                 |    1 +
src/backend/catalog/pg_constraint.c             |    1 +
src/backend/commands/analyze.c                  |    2 ++
src/backend/commands/discard.c                  |    1 +
src/backend/commands/functioncmds.c             |    1 +
src/backend/commands/indexcmds.c                |    1 +
src/backend/commands/sequence.c                 |    1 +
src/backend/commands/tablespace.c               |    1 +
src/backend/commands/vacuum.c                   |    2 ++
src/backend/executor/nodeIndexscan.c            |    1 +
src/backend/executor/nodeSubplan.c              |    1 +
src/backend/executor/nodeTidscan.c              |    1 +
src/backend/optimizer/util/predtest.c           |    1 +
src/backend/parser/parse_clause.c               |    1 +
src/backend/postmaster/bgwriter.c               |    5 +++++
src/backend/postmaster/walwriter.c              |    3 +++
src/backend/replication/syncrep.c               |    6 ++++++
src/backend/replication/walreceiver.c           |    2 ++
src/backend/replication/walreceiverfuncs.c      |    1 +
src/backend/replication/walsender.c             |    1 +
src/backend/storage/ipc/procarray.c             |    1 +
src/backend/storage/ipc/procsignal.c            |    1 +
src/backend/storage/lmgr/lwlock.c               |    2 ++
src/backend/storage/smgr/smgr.c                 |    1 +
src/backend/utils/adt/arrayfuncs.c              |    1 +
src/backend/utils/adt/enum.c                    |    1 +
src/backend/utils/adt/int.c                     |    1 +
src/backend/utils/adt/regexp.c                  |    1 +
src/backend/utils/adt/ri_triggers.c             |    1 +
src/backend/utils/adt/ruleutils.c               |    1 +
src/backend/utils/cache/relcache.c              |    1 +
src/backend/utils/cache/relmapper.c             |    1 +
src/backend/utils/cache/spccache.c              |    1 +
src/backend/utils/fmgr/funcapi.c                |    1 +
src/backend/utils/hash/dynahash.c               |    2 ++
src/backend/utils/resowner/resowner.c           |    1 +
src/backend/utils/time/combocid.c               |    2 ++
src/backend/utils/time/snapmgr.c                |    1 +
src/include/access/gin.h                        |    1 +
src/include/access/heapam.h                     |    2 ++
src/include/access/xact.h                       |    2 ++
src/include/access/xlog.h                       |    1 -
src/include/access/xlog_internal.h              |    2 ++
src/include/catalog/storage.h                   |    2 ++
src/include/commands/copy.h                     |    2 ++
src/include/commands/dbcommands.h               |    1 +
src/include/commands/portalcmds.h               |    1 +
src/include/commands/sequence.h                 |    2 ++
src/include/commands/tablespace.h               |    1 +
src/include/commands/trigger.h                  |    1 +
src/include/executor/execdesc.h                 |    1 +
src/include/executor/functions.h                |    1 +
src/include/executor/spi.h                      |    1 +
src/include/replication/syncrep.h               |    8 +-------
src/include/replication/walsender.h             |    3 +--
src/include/storage/standby.h                   |    2 ++
src/include/tcop/pquery.h                       |    1 +
src/include/tcop/tcopprot.h                     |    2 ++
src/pl/plpgsql/src/pl_comp.c                    |    1 +
src/pl/plpgsql/src/pl_handler.c                 |    1 +
74 files changed, 102 insertions(+), 10 deletions(-)


Re: pgsql: Clean up the #include mess a little.

От
Jeremy Drake
Дата:
Well, this commit seems to have fixed whatever problem mongoose was
having.  Hooray, I guess.

http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=mongoose&dt=2011-09-04%2005%3A45%3A02


On Sun, 4 Sep 2011, Tom Lane wrote:

> Clean up the #include mess a little.
>
> walsender.h should depend on xlog.h, not vice versa.  (Actually, the
> inclusion was circular until a couple hours ago, which was even sillier;
> but Bruce broke it in the expedient rather than logically correct
> direction.)  Because of that poor decision, plus blind application of
> pgrminclude, we had a situation where half the system was depending on
> xlog.h to include such unrelated stuff as array.h and guc.h.  Clean up
> the header inclusion, and manually revert a lot of what pgrminclude had
> done so things build again.
>
> This episode reinforces my feeling that pgrminclude should not be run
> without adult supervision.  Inclusion changes in header files in particular
> need to be reviewed with great care.  More generally, it'd be good if we
> had a clearer notion of module layering to dictate which headers can sanely
> include which others ... but that's a big task for another day.
>
> Branch
> ------
> master
>
> Details
> -------
> http://git.postgresql.org/pg/commitdiff/1609797c25f6b440371045039733d69fe8cb9410
>
> Modified Files
> --------------
> contrib/auto_explain/auto_explain.c             |    1 +
> contrib/cube/cube.c                             |    1 +
> contrib/pg_stat_statements/pg_stat_statements.c |    1 +
> contrib/tsearch2/tsearch2.c                     |    1 +
> src/backend/access/common/reloptions.c          |    2 ++
> src/backend/access/gin/ginarrayproc.c           |    1 +
> src/backend/access/transam/slru.c               |    1 +
> src/backend/access/transam/twophase_rmgr.c      |    1 +
> src/backend/access/transam/varsup.c             |    1 +
> src/backend/access/transam/xact.c               |    3 +++
> src/backend/access/transam/xlogutils.c          |    2 ++
> src/backend/bootstrap/bootstrap.c               |    1 +
> src/backend/catalog/dependency.c                |    1 +
> src/backend/catalog/index.c                     |    1 +
> src/backend/catalog/namespace.c                 |    1 +
> src/backend/catalog/pg_constraint.c             |    1 +
> src/backend/commands/analyze.c                  |    2 ++
> src/backend/commands/discard.c                  |    1 +
> src/backend/commands/functioncmds.c             |    1 +
> src/backend/commands/indexcmds.c                |    1 +
> src/backend/commands/sequence.c                 |    1 +
> src/backend/commands/tablespace.c               |    1 +
> src/backend/commands/vacuum.c                   |    2 ++
> src/backend/executor/nodeIndexscan.c            |    1 +
> src/backend/executor/nodeSubplan.c              |    1 +
> src/backend/executor/nodeTidscan.c              |    1 +
> src/backend/optimizer/util/predtest.c           |    1 +
> src/backend/parser/parse_clause.c               |    1 +
> src/backend/postmaster/bgwriter.c               |    5 +++++
> src/backend/postmaster/walwriter.c              |    3 +++
> src/backend/replication/syncrep.c               |    6 ++++++
> src/backend/replication/walreceiver.c           |    2 ++
> src/backend/replication/walreceiverfuncs.c      |    1 +
> src/backend/replication/walsender.c             |    1 +
> src/backend/storage/ipc/procarray.c             |    1 +
> src/backend/storage/ipc/procsignal.c            |    1 +
> src/backend/storage/lmgr/lwlock.c               |    2 ++
> src/backend/storage/smgr/smgr.c                 |    1 +
> src/backend/utils/adt/arrayfuncs.c              |    1 +
> src/backend/utils/adt/enum.c                    |    1 +
> src/backend/utils/adt/int.c                     |    1 +
> src/backend/utils/adt/regexp.c                  |    1 +
> src/backend/utils/adt/ri_triggers.c             |    1 +
> src/backend/utils/adt/ruleutils.c               |    1 +
> src/backend/utils/cache/relcache.c              |    1 +
> src/backend/utils/cache/relmapper.c             |    1 +
> src/backend/utils/cache/spccache.c              |    1 +
> src/backend/utils/fmgr/funcapi.c                |    1 +
> src/backend/utils/hash/dynahash.c               |    2 ++
> src/backend/utils/resowner/resowner.c           |    1 +
> src/backend/utils/time/combocid.c               |    2 ++
> src/backend/utils/time/snapmgr.c                |    1 +
> src/include/access/gin.h                        |    1 +
> src/include/access/heapam.h                     |    2 ++
> src/include/access/xact.h                       |    2 ++
> src/include/access/xlog.h                       |    1 -
> src/include/access/xlog_internal.h              |    2 ++
> src/include/catalog/storage.h                   |    2 ++
> src/include/commands/copy.h                     |    2 ++
> src/include/commands/dbcommands.h               |    1 +
> src/include/commands/portalcmds.h               |    1 +
> src/include/commands/sequence.h                 |    2 ++
> src/include/commands/tablespace.h               |    1 +
> src/include/commands/trigger.h                  |    1 +
> src/include/executor/execdesc.h                 |    1 +
> src/include/executor/functions.h                |    1 +
> src/include/executor/spi.h                      |    1 +
> src/include/replication/syncrep.h               |    8 +-------
> src/include/replication/walsender.h             |    3 +--
> src/include/storage/standby.h                   |    2 ++
> src/include/tcop/pquery.h                       |    1 +
> src/include/tcop/tcopprot.h                     |    2 ++
> src/pl/plpgsql/src/pl_comp.c                    |    1 +
> src/pl/plpgsql/src/pl_handler.c                 |    1 +
> 74 files changed, 102 insertions(+), 10 deletions(-)
>
>
>

--
When two people are under the influence of the most violent, most
insane, most delusive, and most transient of passions, they are
required to swear that they will remain in that excited, abnormal, and
exhausting condition continuously until death do them part.
        -- George Bernard Shaw

Re: pgsql: Clean up the #include mess a little.

От
Tom Lane
Дата:
Jeremy Drake <pgsql@jdrake.com> writes:
> Well, this commit seems to have fixed whatever problem mongoose was
> having.  Hooray, I guess.
> http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=mongoose&dt=2011-09-04%2005%3A45%3A02

Yeah, I just saw that.  So that confirms (AFAICT) that the inclusion
of walsender.h in xlog.h was what broke it ... but why?  As I said
before, I don't like black magic.

            regards, tom lane