partitioning code reorganization - Mailing list pgsql-hackers

From Alvaro Herrera
Subject partitioning code reorganization
Date
Msg-id 20180413193503.nynq7bnmgh6vs5vm@alvherre.pgsql
Whole thread Raw
Responses Re: partitioning code reorganization
List 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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: crash with sql language partition support function
Next
From: Alvaro Herrera
Date:
Subject: Re: partitioning code reorganization