pgsql: Rationalize common/relpath.[hc].

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Rationalize common/relpath.[hc].
Дата
Msg-id E1Wfc5l-0002W2-6O@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Rationalize common/relpath.[hc].

Commit a73018392636ce832b09b5c31f6ad1f18a4643ea created rather a mess by
putting dependencies on backend-only include files into include/common.
We really shouldn't do that.  To clean it up:

* Move TABLESPACE_VERSION_DIRECTORY back to its longtime home in
catalog/catalog.h.  We won't consider this symbol part of the FE/BE API.

* Push enum ForkNumber from relfilenode.h into relpath.h.  We'll consider
relpath.h as the source of truth for fork numbers, since relpath.c was
already partially serving that function, and anyway relfilenode.h was
kind of a random place for that enum.

* So, relfilenode.h now includes relpath.h rather than vice-versa.  This
direction of dependency is fine.  (That allows most, but not quite all,
of the existing explicit #includes of relpath.h to go away again.)

* Push forkname_to_number from catalog.c to relpath.c, just to centralize
fork number stuff a bit better.

* Push GetDatabasePath from catalog.c to relpath.c; it was rather odd
that the previous commit didn't keep this together with relpath().

* To avoid needing relfilenode.h in common/, redefine the underlying
function (now called GetRelationPath) as taking separate OID arguments,
and make the APIs using RelFileNode or RelFileNodeBackend into macro
wrappers.  (The macros have a potential multiple-eval risk, but none of
the existing call sites have an issue with that; one of them had such a
risk already anyway.)

* Fix failure to follow the directions when "init" fork type was added;
specifically, the errhint in forkname_to_number wasn't updated, and neither
was the SGML documentation for pg_relation_size().

* Fix tablespace-path-too-long check in CreateTableSpace() to account for
fork-name component of maximum-length pathnames.  This requires putting
FORKNAMECHARS into a header file, but it was rather useless (and
actually unreferenced) where it was.

The last couple of items are potentially back-patchable bug fixes,
if anyone is sufficiently excited about them; but personally I'm not.

Per a gripe from Christoph Berg about how include/common wasn't
self-contained.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2d00190495b22e0d0ba351b2cda9c95fb2e3d083

Modified Files
--------------
contrib/pg_xlogdump/pg_xlogdump.c               |    1 -
doc/src/sgml/func.sgml                          |   20 ++--
src/backend/access/rmgrdesc/smgrdesc.c          |    1 -
src/backend/access/rmgrdesc/xactdesc.c          |    1 -
src/backend/access/rmgrdesc/xlogdesc.c          |    1 -
src/backend/access/transam/xlogutils.c          |    1 -
src/backend/catalog/catalog.c                   |   51 ---------
src/backend/commands/tablecmds.c                |    1 -
src/backend/commands/tablespace.c               |    7 +-
src/backend/replication/basebackup.c            |    2 +-
src/backend/replication/logical/reorderbuffer.c |   11 +-
src/backend/storage/buffer/bufmgr.c             |    1 -
src/backend/storage/buffer/localbuf.c           |    1 -
src/backend/storage/file/fd.c                   |    1 -
src/backend/storage/smgr/md.c                   |    1 -
src/backend/utils/adt/dbsize.c                  |    1 -
src/backend/utils/adt/misc.c                    |    1 -
src/backend/utils/cache/relcache.c              |    1 -
src/common/relpath.c                            |  137 +++++++++++++++++------
src/include/catalog/catalog.h                   |   12 +-
src/include/common/relpath.h                    |   60 +++++++---
src/include/storage/relfilenode.h               |   23 +---
22 files changed, 173 insertions(+), 163 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Check for interrupts and stack overflow during rule/view dumps.
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Consistently allow reading of messages from a detached shm_mq.