From: | "Thomas Hallgren" <thhal(at)mailblocks(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: GUC variable set, TODO |
Date: | 2004-04-22 09:24:29 |
Message-ID: | c68352$dgv$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Here's a draft of the solution that I'm currently working on for custom GUC
variables:
A new string variable 'custom_variable_classes' is introduced. This variable
is a comma separated string of identifiers. Each identifier denots a 'class'
that will allow its members to be added without error. This variable must be
defined in postmaster.conf.
The lexer (guc_file.c) is changed so that it can accept a qualified name in
the form <ID>.<ID> as the name of a variable. I also changed so that the
'custom_variable_classes', if found, is added first of all variables in
order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created with
20% slack and can grow dynamically. A capacity and a need-sort flag is
introduced to avoid resizing and resorting every time a new variable is
added. guc_variables and num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly. Question:
Who uses GucInfoMain and why does it call build_guc_variables() ?
The find_option() function, when passed a missing name, will check if the
name is qualified. If the name is qualified and if the qualifier denotes a
class included in the 'custom_variable_classes', a placeholder variable will
be created. Such a placeholder will not participate in a list operation but
will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call to
these functions will define a new GUC-variable. If a placeholder exists it
will be replaced but it's value will be used in place of the default value.
The valueAddr is assumed ot point at a default value when the define
function is called. The only constraint that is imposed on a Custom variable
is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed its
variable definitions. At that time, no placeholders should remain for the
class that the module uses.
Comments or suggestions so far?
Kind regards,
Thomas Hallgren
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in message
news:25798(dot)1082390565(at)sss(dot)pgh(dot)pa(dot)us(dot)(dot)(dot)
> Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
> > Ok. I understand that you suggest to Thomas that he should only touch
> > the search array to insert new pointers to guc description structures,
> > which may come from outside or be newly allocated, without touching the
> > existing static versions for internal guc variables.
>
> Right. IIRC there are some comments about this possibility already in
> the source code.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
From | Date | Subject | |
---|---|---|---|
Next Message | Shachar Shemesh | 2004-04-22 09:35:20 | License question |
Previous Message | Shachar Shemesh | 2004-04-22 09:12:37 | License question |