Re: splitting htup.h

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: splitting htup.h
Date: 2012-06-16 03:11:39
Message-ID: 1339814128-sup-259@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Tom Lane's message of vie jun 15 21:06:21 -0400 2012:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > This patch splits htup.h in two pieces -- the first one (tupbasics.h;
> > not wedded to the name) does not include many other headers and is just
> > enough to have other parts of the code create tuples and pass them
> > around, to be used by most other headers. The other one (which keeps
> > the name htup.h) contains internal tuple stuff (struct declarations
> > etc).
>
> > Before patch, htup.h is directly or indirectly included by 364 .c files
> > in src/backend; after patch, that's reduced to 299 files (that's 65
> > files less to compile if you modify the header).
>
> That's kind of a disappointing result --- if we're going to split htup.h
> into public and private parts, I would have hoped for a much smaller
> inclusion footprint for the private part. Maybe you could adjust the
> boundary between public and private parts a bit more? If we can't cut
> the footprint I'm inclined to think this isn't worth the code churn.

Yeah, I have another version of the patch (attached) that includes
HeapTupleData in the public part; this means catcache.h does not need
htup.h, which was the main propagation vector in the original patch.
With that, 162 .c files include htup.h -- about 130 of them do so
directly, and the rest do so through either relscan.h or tuptoaster.h.

Is this enough? I think the next step would require moving
HeapTupleHeaderData to the public header as well; I haven't checked to
see how much better it gets. It would require copying some of the
other includes in htup.h into the public header, though, so there is a
tradeoff.

(Another idea: maybe we could split in three parts rather than two).

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
tupbasics-2.patch application/octet-stream 61.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-06-16 03:18:54 Re: Backup docs
Previous Message Tom Lane 2012-06-16 02:48:27 Re: Re: [COMMITTERS] pgsql: Run pgindent on 9.2 source tree in preparation for first 9.3