Re: Breaking compile-time dependency cycles of Postgres subdirs?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Christian Convey <christian(dot)convey(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Breaking compile-time dependency cycles of Postgres subdirs?
Date: 2014-02-10 15:28:40
Message-ID: 10111.1392046120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Feb 7, 2014 at 7:39 AM, Christian Convey
> <christian(dot)convey(at)gmail(dot)com> wrote:
>> As someone very new to this code base, I think these cycles make it a little
>> harder to figure out the runtime and compile-time dependencies between the
>> subsystems these directories seem to represent. I wonder if that's a
>> problem others face as well?

> There are probably some cases that could be improved, but I have my
> doubts about whether eliminating cycles is a reasonable goal.

Aside from Robert's points, I have a couple of thoughts:

I think if it had been a clear, enforced goal all along, it might've been
possible to build the system with such a restriction (for the most part at
least). At this point though, the amount of work and code churn involved
seems like it'd far exceed the benefits.

It's also fair to question how much improvement in comprehensibility
we'd really get. It's not like code's been dropped into completely
random places where it doesn't belong. In the end, Postgres is a pretty
big system and it's necessarily going to take time for newbies to learn
their way around it.

I believe there are some cases where circularity is just about
unavoidable. As an example, the error reporting code in elog.c depends
on memory management in mcxt.c, which itself uses elog.c's reporting
facilities. There's another mutual dependency between error reporting
and GUC (server configuration control). And on and on. I think the
coding rule you're suggesting would require that each such dependency
loop be confined to one major backend subsystem, which seems rather
arbitrary.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christian Convey 2014-02-10 15:37:53 Re: Breaking compile-time dependency cycles of Postgres subdirs?
Previous Message Tom Lane 2014-02-10 15:13:57 Re: jsonb and nested hstore