In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to configure PostgreSQL parameter processing system, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.
Configuration parameters (or GUC variables, grand unified configuration) are common settings that appear in postgresql.conf. For more information, see document 19. Server Configuration. This series focuses on how they are set and play a role in the code.
There will be a lot of clear content for this feeling, which will be written in several articles. This article mainly talks about the meaning of the members of the general structure.
1. Configuration parameter types
Boolean, shaping, floating point (double), string, enumeration
Each type has its own definition structure, and they also have a common structure, as shown below.
2. Parameter definition general structure (src/include/utils/guc_tables.h)
Struct config_generic {/ * constant fields, must be set correctly in initial value: * / const char * name; / * name of variable-MUST BE FIRST * / GucContext context; / * context required to set the variable * / enum config_group group; / * to help organize variables by function * / const char * short_desc; / * short desc. Of this variable's purpose * / const char * long_desc; / * long desc. Of this variable's purpose * / int flags; / * flag bits, see guc.h * / / * variable fields, initialized at runtime: * / enum config_type vartype; / * type of variable (set only at startup) * / int status; / * status bits, see below * / GucSource source; / * source of the current actual value * / GucSource reset_source; / * source of the reset_value * / GucContext scontext / * context that set the current value * / GucContext reset_scontext; / * context that set the reset value * / GucStack * stack; / * stacked prior values * / void * extra; / * "extra" pointer for current actual value * / char * sourcefile; / * file current setting is from (NULL if not * set in config file) * / int sourceline; / * line in sourcefile * /}
Here are some important items to explain their functions one by one.
3. Configuration parameter name name
There is no need to say more.
4. Context context (src/include/utils/guc.h) where the parameters are located.
Typedef enum {PGC_INTERNAL, PGC_POSTMASTER, PGC_SIGHUP, PGC_SU_BACKEND, PGC_BACKEND, PGC_SUSET, PGC_USERSET} GucContext
INTERNAL does not allow modification, or post-compilation modification, and some parameters can be defined at compile time, such as block size. After the compilation is completed, if you modify and compile a new program, it is likely that the initialized data cluster will not be started.
In a nutshell, such parameters can only be viewed by the show command.
POSTMASTER can only be set when the database is started, and it will not work to modify it in time after startup, such as the configuration parameter shared_buffers mentioned in the previous article. Modifying it and reloading the configuration file will only get the message: parameter "shared_buffers" cannot be changed without restarting the server.
SIGHUP can be modified when the database is started, or by using the HUP signal (command pg_ctl reload). They cannot be modified when the backend starts (connection parameters, read part of the StartupPacket code if you are interested) or during a session (the SET command).
The comments before the config_generic structure definition are clearly written, and the context definition parameters are allowed to be modified in what scenarios.
5. Classify group
The classification of parameters can be clearly seen in the document. Take the v11 document as an example:
19.2. File Locations19.3. Connections and Authentication 19.3.1. Connection Settings 19.3.2. Authentication 19.3.3. SSL
They correspond to enumerated config_group 's: FILE_LOCATIONS, CONN_AUTH, CONN_AUTH_SETTINGS, CONN_AUTH_AUTH, CONN_AUTH_SSL
There seems to be no explanation for this.
6. Parameter description short_desc and long_desc
Define a short and detailed description of the variable
7. Flag bit flags
Define the behavior of configuration parameters, such as:
GUC_LIST_INPUT input can be in list format GUC_NO_SHOW_ALL is not included in the result of the SHOW ALL command
For more definitions, see src/include/utils/guc.h.
8. Initial values of other members
The rest of the members are initialized when the database starts, and they are not included in the initial definition in guc.c (only part of it, it should be).
For example, vartype represents the type of configuration parameter.
The above is how to configure the parameter processing system for PostgreSQL. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.