partitioning code reorganization

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: partitioning code reorganization
Date: 2018-04-13 19:35:03
Message-ID: 20180413193503.nynq7bnmgh6vs5vm@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund wrote:

> It'd be good to adjust the thread topic - this surely isn't about the
> crash anymore. And it's good, especially given we're past the feature
> freeze etc, if the subject conveyed what's happening?

Sure thing. This thread comes from:
https://postgr.es/m/20180413182133.euxapzksj3ejxo2h@alap3.anarazel.de

Here's my proposed reorganization patch. This cleans up the
partitioning header files, and creates new source files. The split was
described by Amit in the previous thread.

The new source files are:
src/backend/partitioning/partbounds.c (2057 lines)
src/backend/utils/cache/partcache.c (972 lines)

That code comes mostly from partition.c, but there's also some code
coming from relcache.c.

Two new header files are created:

src/include/partitioning/partdefs.h (this one is used by most other
header files needing to refer to partitioning features).
src/include/utils/partcache.h

This compiles with no warnings, and passes cpluspluscheck.

Inclusions of catalog/partition.h all over the place has been reduced to
a minimum. This is a good thing: that header was causing bleed of
unrelated stuff into a lot of seemingly unrelated places, as you can see
in a few files that had to gain some completely unrelated #includes:

contrib/pageinspect/hashfuncs.c:
+#include "utils/rel.h"

contrib/pg_stat_statements/pg_stat_statements.c
+#include "utils/acl.h"

src/backend/catalog/pg_constraint.c
+#include "access/tupconvert.h"

src/backend/tcop/utility.c
+#include "utils/rel.h"

src/backend/utils/misc/pg_controldata.c
+#include "access/xlog.h"

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v5-0001-Reorganize-partitioning-code-structure.patch text/plain 206.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-04-13 20:48:06 Re: partitioning code reorganization
Previous Message Andres Freund 2018-04-13 18:21:33 Re: crash with sql language partition support function