How to add new config parameter
+===============================
This document explains how to add a new configuration parameter. In We
use new enum type configuration parameter
"disable_load_balance_on_write" as an example.
Step1: add enum definition
+==========================
Add an enum type to src/include/pool_config.h.
} DLBOW_OPTION;
Step2: Add the new entry to POOL_CONFIG struct
+==============================================
There's a struct called "POOL_CONFIG" holding all config
variables. Add the new configparameter name along with the enum
*/
Step3: Add config_emum_entery array to src/config/pool_config.c.
+================================================================
static const struct config_enum_entry disable_load_balance_on_write_options[] = {
{"off", DLBOW_OFF, false},
{NULL, 0, false}
};
-config_enum_entry is defined in src/include/pool_config.h:
+config_enum_entry is defined in src/include/pool_config_variable.h:
/*
* The possible values of an enum variable are specified by an array of
bool hidden;
};
+Other than enum config type, we have: config_bool, config_int,
+config_int_array, config_double, config_double_array, config_long,
+config_string, config_string_array, and config_list. See
+src/include/pool_config_variable.h for more details.
+
+Note that each config_* struct they have common data as struct
+config_generic. config_generic is defined as follows in
+src/include/pool_config_variable.h:
+
+struct config_generic
+{
+ /* constant fields, must be set correctly in initial value: */
+ const char *name; /* name of variable - MUST BE FIRST */
+ ConfigContext context; /* context required to set the variable */
+ config_group group; /* to help organize variables by function */
+ const char *description; /* short desc. of this variable's purpose */
+ config_type vartype; /* type of variable (set only at startup) */
+ bool dynamic_array_var; /* true if the variable name contains index postfix */
+ int flags; /* flags */
+ int max_elements; /* number of maximum elements, only valid for array type configs */
+ int status; /* status bits, see below */
+ int sourceline; /* line in source file */
+
+
+ GucSource *sources; /* source of the current actual value, For array type config elements
+ * it contains the corosponding source of each individual element */
+ GucSource *reset_sources; /* source of the reset value, For array type config elements
+ * it contains the corosponding source of each individual element */
+ ConfigContext *scontexts; /* context that set the current value, For array type config elements
+ * it contains the corosponding context of each individual element */
+
+};
+
+
Step4: add an entry to static struct config_enum ConfigureNamesEnum[].
+=====================================================================
{
{"disable_load_balance_on_write", CFGCXT_RELOAD, LOAD_BALANCE_CONFIG,
Step5: add the new config parameter to example config files.
+============================================================
You need to the new config sample to config example files under
src/sample/pgpool.conf.sample*
Step6: add the new config parameter to the report program.
+==========================================================
src/utils/pool_process_reporting.c
i++;
Step7: remeber to add documents and tests!
+==========================================