pgpool2.git / summary / log / commit / refs

commit    30ad3a8fcc7b00a0064361677659d1a906da786c
Author:   Tatsuo Ishii <ishii@postgresql.org>
Commit:   Muhammad Usama <m.usama@gmail.com>
Date:     Sun Jan 26 06:02:04 2014 +0000

    Add new parameter "check_unlogged_table".
    
    By turning this off pgpool-II does not check unlogged tables while
    executing SELECTs, thus reduces the overhead caused by the check. Of
    course users should be absolutely sure what they are doing if do so.


doc/pgpool-en.html | 15 +++++++++++++-- doc/pgpool-ja.html | 14 ++++++++++++-- src/config/pool_config.c | 13 +++++++++++++ src/config/pool_config.l | 13 +++++++++++++ src/context/pool_query_context.c | 2 +- src/include/pool_config.h | 1 + src/sample/pgpool.conf.sample | 7 +++++++ src/sample/pgpool.conf.sample-master-slave | 7 +++++++ src/sample/pgpool.conf.sample-replication | 7 +++++++ src/sample/pgpool.conf.sample-stream | 7 +++++++ src/utils/pool_process_reporting.c | 15 +++++++++++++++ 11 files changed, 96 insertions(+), 5 deletions(-) diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html index 83a9199a9..f7bb0d3bc 100644 --- a/doc/pgpool-en.html +++ b/doc/pgpool-en.html @@ -7,7 +7,7 @@ </head> <!-- hhmts start --> -Last modified: Sun Jan 26 09:15:34 JST 2014 +Last modified: Sun Jan 26 14:44:34 JST 2014 <!-- hhmts end --> <body bgcolor="#ffffff"> @@ -661,7 +661,7 @@ max_pool*num_init_children*2 &lt;= (max_connections - superuser_reserved_connect This parameter can only be set at server start.</p> </dd> -<dt><a name="LISTEN_BACKLOG_MULTIPLIERE"></a>listen_backlog_multiplier</dt> +<dt><a name="LISTEN_BACKLOG_MULTIPLIERE"></a>listen_backlog_multiplier <span class="version">V3.4 -</span></dt> <dd> <p> Controls the length of connection queue from frontend to pgpool-II. The default is 2. @@ -1352,6 +1352,17 @@ local0.* /var/log/pgpool.log </p> </dd> +<dt><a name="CHECK_UNLOGGED_TABLE"></a>check_unlogged_table <span class="version">V3.4 -</span></dt> + <dd> + <p> + If on, enable unlogged table check in SELECT statements. This + initiates queries against system catalog of primary/master thus + increases load of primary/master. If you are absolutely sure that your + system never uses unlogged (for example, you are using PostgreSQL 9.0 or before) tables and you want to save access + to primary/master, you could turn this off. Default is on. + </p> + </dd> + </dl> <h2>Generating SSL certificates</h2> diff --git a/doc/pgpool-ja.html b/doc/pgpool-ja.html index 3119e8a57..9c1c9d26f 100644 --- a/doc/pgpool-ja.html +++ b/doc/pgpool-ja.html @@ -8,7 +8,7 @@ <body> <!-- hhmts start --> -Last modified: Sun Jan 26 09:15:49 JST 2014 +Last modified: Sun Jan 26 14:46:40 JST 2014 <!-- hhmts end --> <body bgcolor="#ffffff"> @@ -677,7 +677,7 @@ net.core.somaxconn = 256 </p> </dd> -<dt><a name="LISTEN_BACKLOG_MULTIPLIERE"></a>listen_backlog_multiplier</dt> +<dt><a name="LISTEN_BACKLOG_MULTIPLIERE"></a>listen_backlog_multiplier <span class="version">V3.4 -</span></dt> <dd> <p> フロントエンドからpgpool-IIへの接続待ち行列の長さを制御します。デフォルト値は2です。接続待ち行列(listenシステムコールのbacklogパラメータ)の長さは、listen_backlog_multiplier * num_init_children で決まります。もし待ち行列の長さが不足する場合にはこのパラメータを増やしてください。その際、OSの設定値によっては待ち行列を長く出来ないことがあります。詳細は<a href="#NUM_INIT_CHILDREN">num_init_children</a>の項を参照してください。 @@ -1381,6 +1381,16 @@ local0.* /var/log/pgpool.log </p> </dd> +<dt><a name="CHECK_UNLOGGED_TABLE"></a>check_unlogged_table <span class="version">V3.4 〜</span></dt> + <dd> + <p> + もしonなら、SELECTに含まれるテーブルがunloggedテーブルかどうかのチェックを行います。 + このチェックは、primary/masterのシステムカタログへのアクセスを発生させ、それなりに負荷を上げます。 + もしunloggedテーブルを使っていないということが確かで(たとえばPostgreSQLのバージョンが9.0かそれより前)、primary/masterの負荷を少しでも下げたいのであれば、 + offにすることができます。デフォルトはonです。 + </p> + </dd> + </dl> <h2>SSL証明書の生成</h2> diff --git a/src/config/pool_config.c b/src/config/pool_config.c index a20e5eaff..9a64bc922 100644 --- a/src/config/pool_config.c +++ b/src/config/pool_config.c @@ -1966,6 +1966,7 @@ int pool_init_config(void) pool_config->relcache_expire = 0; pool_config->relcache_size = 256; pool_config->check_temp_table = 1; + pool_config->check_unlogged_table = 1; pool_config->lists_patterns = NULL; pool_config->pattc = 0; pool_config->current_pattern_size = 0; @@ -4352,6 +4353,18 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) pool_config->check_temp_table = v; } + else if (!strcmp(key, "check_unlogged_table") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context)) + { + int v = eval_logical(yytext); + + if (v < 0) + { + pool_error("pool_config: invalid value %s for %s", yytext, key); + return(-1); + } + pool_config->check_unlogged_table = v; + } + else if (!strcmp(key, "memory_cache_enabled") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context)) { diff --git a/src/config/pool_config.l b/src/config/pool_config.l index 1d4508fa0..9b82deb3f 100644 --- a/src/config/pool_config.l +++ b/src/config/pool_config.l @@ -241,6 +241,7 @@ int pool_init_config(void) pool_config->relcache_expire = 0; pool_config->relcache_size = 256; pool_config->check_temp_table = 1; + pool_config->check_unlogged_table = 1; pool_config->lists_patterns = NULL; pool_config->pattc = 0; pool_config->current_pattern_size = 0; @@ -2627,6 +2628,18 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) pool_config->check_temp_table = v; } + else if (!strcmp(key, "check_unlogged_table") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context)) + { + int v = eval_logical(yytext); + + if (v < 0) + { + pool_error("pool_config: invalid value %s for %s", yytext, key); + return(-1); + } + pool_config->check_unlogged_table = v; + } + else if (!strcmp(key, "memory_cache_enabled") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context)) { diff --git a/src/context/pool_query_context.c b/src/context/pool_query_context.c index c47b6843d..11d01bf32 100644 --- a/src/context/pool_query_context.c +++ b/src/context/pool_query_context.c @@ -462,7 +462,7 @@ void pool_where_to_send(POOL_QUERY_CONTEXT *query_context, char *query, Node *no * If unlogged table is used in the SELECT, * we prefer to send to the primary. */ - else if (pool_has_unlogged_table(node)) + else if (pool_config->check_unlogged_table && pool_has_unlogged_table(node)) { pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID); } diff --git a/src/include/pool_config.h b/src/include/pool_config.h index 88fb9f47a..8e49f13a3 100644 --- a/src/include/pool_config.h +++ b/src/include/pool_config.h @@ -198,6 +198,7 @@ typedef struct { time_t relcache_expire; /* relation cache life time in seconds */ int relcache_size; /* number of relation cache life entry */ int check_temp_table; /* enable temporary table check */ + int check_unlogged_table; /* enable unlogged table check */ /* followings are for regex support and do not exist in the configuration file */ RegPattern *lists_patterns; /* Precompiled regex patterns for black/white lists */ diff --git a/src/sample/pgpool.conf.sample b/src/sample/pgpool.conf.sample index 27f8afcaf..850f6c6a4 100644 --- a/src/sample/pgpool.conf.sample +++ b/src/sample/pgpool.conf.sample @@ -611,6 +611,13 @@ check_temp_table = on # and you want to save access to primary/master, you could turn this off. # Default is on. +check_unlogged_table = on + # If on, enable unlogged table check in SELECT statements. + # This initiates queries against system catalog of primary/master + # thus increases load of master. + # If you are absolutely sure that your system never uses unlogged tables + # and you want to save access to primary/master, you could turn this off. + # Default is on. #------------------------------------------------------------------------------ # ON MEMORY QUERY MEMORY CACHE diff --git a/src/sample/pgpool.conf.sample-master-slave b/src/sample/pgpool.conf.sample-master-slave index d5e5c5b64..09a20ef8f 100644 --- a/src/sample/pgpool.conf.sample-master-slave +++ b/src/sample/pgpool.conf.sample-master-slave @@ -610,6 +610,13 @@ check_temp_table = on # and you want to save access to primary/master, you could turn this off. # Default is on. +check_unlogged_table = on + # If on, enable unlogged table check in SELECT statements. + # This initiates queries against system catalog of primary/master + # thus increases load of master. + # If you are absolutely sure that your system never uses unlogged tables + # and you want to save access to primary/master, you could turn this off. + # Default is on. #------------------------------------------------------------------------------ # ON MEMORY QUERY MEMORY CACHE diff --git a/src/sample/pgpool.conf.sample-replication b/src/sample/pgpool.conf.sample-replication index 80978d74f..871db3a8f 100644 --- a/src/sample/pgpool.conf.sample-replication +++ b/src/sample/pgpool.conf.sample-replication @@ -609,6 +609,13 @@ check_temp_table = on # and you want to save access to primary/master, you could turn this off. # Default is on. +check_unlogged_table = on + # If on, enable unlogged table check in SELECT statements. + # This initiates queries against system catalog of primary/master + # thus increases load of master. + # If you are absolutely sure that your system never uses unlogged tables + # and you want to save access to primary/master, you could turn this off. + # Default is on. #------------------------------------------------------------------------------ # ON MEMORY QUERY MEMORY CACHE diff --git a/src/sample/pgpool.conf.sample-stream b/src/sample/pgpool.conf.sample-stream index 749759904..3667653a3 100644 --- a/src/sample/pgpool.conf.sample-stream +++ b/src/sample/pgpool.conf.sample-stream @@ -610,6 +610,13 @@ check_temp_table = on # and you want to save access to primary/master, you could turn this off. # Default is on. +check_unlogged_table = on + # If on, enable unlogged table check in SELECT statements. + # This initiates queries against system catalog of primary/master + # thus increases load of master. + # If you are absolutely sure that your system never uses unlogged tables + # and you want to save access to primary/master, you could turn this off. + # Default is on. #------------------------------------------------------------------------------ # ON MEMORY QUERY MEMORY CACHE diff --git a/src/utils/pool_process_reporting.c b/src/utils/pool_process_reporting.c index f6df35c93..5e403aa95 100644 --- a/src/utils/pool_process_reporting.c +++ b/src/utils/pool_process_reporting.c @@ -593,6 +593,21 @@ POOL_REPORT_CONFIG* get_config(int *nrows) strncpy(status[i].desc, "relation cache expiration time in seconds", POOLCONFIG_MAXDESCLEN); i++; + strncpy(status[i].name, "relcache_size", POOLCONFIG_MAXNAMELEN); + snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->relcache_size); + strncpy(status[i].desc, "number of relation cache entry", POOLCONFIG_MAXDESCLEN); + i++; + + strncpy(status[i].name, "check_temp_table", POOLCONFIG_MAXNAMELEN); + snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->check_temp_table); + strncpy(status[i].desc, "enable temporary table check", POOLCONFIG_MAXDESCLEN); + i++; + + strncpy(status[i].name, "check_unlogged_table", POOLCONFIG_MAXNAMELEN); + snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->check_unlogged_table); + strncpy(status[i].desc, "enable unlogged table check", POOLCONFIG_MAXDESCLEN); + i++; + strncpy(status[i].name, "parallel_mode", POOLCONFIG_MAXNAMELEN); snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->parallel_mode); strncpy(status[i].desc, "if non 0, run in parallel query mode", POOLCONFIG_MAXDESCLEN); [parent: 14555a58d9c8]