From f52e6051f226ed77539962b8c4c440f7616feafd Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sun, 1 Apr 2018 06:39:39 +0900 Subject: [PATCH] Update config README file. --- src/config/README | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/config/README b/src/config/README index b92b3f6fd..a7b23af8d 100644 --- a/src/config/README +++ b/src/config/README @@ -1,10 +1,12 @@ 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. @@ -17,6 +19,7 @@ typedef enum DLBOW_OPTION } 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 @@ -35,6 +38,7 @@ defined above to src/include/pool_config.h. */ 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}, @@ -44,7 +48,7 @@ static const struct config_enum_entry disable_load_balance_on_write_options[] = {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 @@ -58,7 +62,42 @@ struct config_enum_entry 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, @@ -108,11 +147,13 @@ struct config_generic 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 @@ -122,3 +163,4 @@ Step6: add the new config parameter to the report program. i++; Step7: remeber to add documents and tests! +========================================== -- 2.39.5