Re: GUC assign hooks (was Re: wal_buffers = -1 and SIGHUP)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: GUC assign hooks (was Re: wal_buffers = -1 and SIGHUP)
Date: 2011-04-04 19:52:53
Message-ID: BANLkTimMOqN_mXkegf67U9-CECQJkEEBow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 4, 2011 at 3:14 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Mon, Apr 4, 2011 at 2:58 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Another variant would be to allow the check_hook to pass back a separate
>>> "void *" value that could be passed on to the assign_hook, containing
>>> any necessary derived data.  This is logically a bit cleaner, and would
>>> work for all types of GUC variables; but it would make things messier in
>>> guc.c since there would be an additional value to pass around.  I'm not
>>> convinced it's worth that, but could be talked into it if anyone feels
>>> strongly about it.
>
>> I haven't really got the mental energy to think through all of this
>> right now in detail, but I think that might be better.  I think
>> there's more kludgery here than we're going to fix in one pass, so as
>> long as we're making improvements, I'm happy.  Is there any case for
>> using a Datum rather than a void * so people can pack a short quantity
>> in directly without allocating memory, or are we expecting this to
>> always be (say) a struct pointer?
>
> Well, I was intending to insist that the void* parameter point to a
> single malloc'd block, so that guc.c could release it when the value was
> no longer of interest by doing free().  If we don't say that, then we
> are going to need a "free" hook for those objects, which is surely way
> more notational overhead than is likely to be repaid for the occasional
> cases where a single OID or whatever would be sufficient info.

OK. Please comment the crap out of whatever you do, or maybe even add
a README. This stuff is just a bit arcane, and guideposts help a lot.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-04-04 20:15:46 Re: [HACKERS] Uppercase SGML entity declarations
Previous Message Susanne Ebrecht 2011-04-04 19:20:57 Re: [HACKERS] Uppercase SGML entity declarations