Update config README file.
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 31 Mar 2018 21:39:39 +0000 (06:39 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 31 Mar 2018 21:40:25 +0000 (06:40 +0900)
src/config/README

index b92b3f6fd488bf1f05bf977ce3c4cd5fa777dd73..a7b23af8d22a29691441dabc684fff86bf779307 100644 (file)
@@ -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!
+==========================================