Re: split rm_name and rm_desc out of rmgr.c

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: split rm_name and rm_desc out of rmgr.c
Date: 2013-02-04 23:45:04
Message-ID: 20130204234504.GA1602@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-02-04 17:27:39 -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > pg_xlogdump needs access to the *_desc functions for each rmgr. We
> > already moved forward quite a bit by splitting those functions out of
> > their containing files; so now they are compilable separately. Good.
> > The remaining task is enabling the code to find those functions in the
> > first place; currently, the function pointers live in rmgr.c which is
> > not compilable by frontend code because it contains pointers to other
> > functions. Hence the attached patch splits RmgrData into two; the names
> > and rm_desc functions go into a new file which can be compiled easily by
> > frontend.
>
> > Proposed patch attached.
>
> This seems pretty ugly to me.
>
> Couldn't we do something similar to the design for SQL keyword constants,
> wherein the actual data is in macros in a header file (providing exactly
> one source of truth for each RM) and then various .c files can #include
> that after #defining the macro as they need? See
> src/include/parser/kwlist.h and the files that include that.

My original patch just surrounded the backend-only functions by a macro
which was defined to NULL in #ifdef FRONTEND. I still think thats the
best way to go. People objected to that though...
Other than that I find duplicating the whole table by far the best
approach. Splitting parts off seems to be more complex than warranted
without actually getting rid of duplication.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-02-05 01:15:18 Re: split rm_name and rm_desc out of rmgr.c
Previous Message Hannu Krosing 2013-02-04 23:42:45 Re: json api WIP patch