pgpool2.git / summary / log / commit / refs
commit ab66d2093239b6161b95ac8fa88554e131a7306b
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Wed Jun 06 02:08:12 2012 +0000
Add new directive "check_temp_table".
doc/pgpool-en.html | 12 +++++++++++-
doc/pgpool-ja.html | 18 +++++++++++++++++-
pgpool.conf.sample | 8 ++++++++
pgpool.conf.sample-master-slave | 8 ++++++++
pgpool.conf.sample-replication | 8 ++++++++
pgpool.conf.sample-stream | 8 ++++++++
pool_config.c | 13 +++++++++++++
pool_config.h | 1 +
pool_config.l | 13 +++++++++++++
pool_query_context.c | 2 +-
10 files changed, 88 insertions(+), 3 deletions(-)
diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html
index 4ed8a27af..63160eb69 100644
--- a/doc/pgpool-en.html
+++ b/doc/pgpool-en.html
@@ -7,7 +7,7 @@
</head>
<!-- hhmts start -->
-Last modified: Tue Jun 5 14:58:30 JST 2012
+Last modified: Wed Jun 6 11:03:08 JST 2012
<!-- hhmts end -->
<body bgcolor="#ffffff">
@@ -1156,9 +1156,19 @@ local0.* /var/log/pgpool.log
"pool_search_relcache: cache replacement happend"
</pre>
</p>
+ </dd>
+<dt><a name="temp_table_check"></a>temp_table_check <span class="version">V3.1 -</span></dt>
+ <dd>
+ <p>
+ If on, enable temporary 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 temporary 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 f43f07b41..d6c8f5210 100644
--- a/doc/pgpool-ja.html
+++ b/doc/pgpool-ja.html
@@ -8,7 +8,7 @@
<body>
<!-- hhmts start -->
-Last modified: Tue Jun 5 14:55:32 JST 2012
+Last modified: Wed Jun 6 11:00:32 JST 2012
<!-- hhmts end -->
<body bgcolor="#ffffff">
@@ -1189,6 +1189,22 @@ local0.* /var/log/pgpool.log
</p>
</dd>
+<dt><a name="CHECK_TEMP_TABLE"></a>check_temp_table <span class="version">V3.2 $B!A(B</span></dt>
+ <dd>
+ <p>
+ $B$b$7(Bon$B$J$i!"(BSELECT$B$K4^$^$l$k%F!<%V%k$,0l;~%F!<%V%k$+$I$&$+$N%A%'%C%/$r9T$$$^$9!#(B
+ $B$3$N%A%'%C%/$O!"(Bprimary/master$B$N%7%9%F%`%+%?%m%0$X$N%"%/%;%9$rH/@8$5$;!"$=$l$J$j$KIi2Y$r>e$2$^$9!#(B
+ $B$b$70l;~%F!<%V%k$r;H$C$F$$$J$$$H$$$&$3$H$,3N$+$G!"(Bprimary/master$B$NIi2Y$r>/$7$G$b2<$2$?$$$N$G$"$l$P!"(B
+ off$B$K$9$k$3$H$,$G$-$^$9!#%G%U%)%k%H$O(Bon$B$G$9!#(B
+ </p>
+ <p>
+ <pre>
+ "pool_search_relcache: cache replacement happend"
+ </pre>
+ $B$N$h$&$J%a%C%;!<%8$,%m%0$KIQHK$K=P$k>l9g$O!"$3$N?t;z$rBg$-$/$7$F$/$@$5$$!#(B
+ </p>
+ </dd>
+
</dl>
<h2>SSL$B>ZL@=q$N@8@.(B</h2>
diff --git a/pgpool.conf.sample b/pgpool.conf.sample
index 733c43945..400f95315 100644
--- a/pgpool.conf.sample
+++ b/pgpool.conf.sample
@@ -443,6 +443,14 @@ relcache_size = 256
# "pool_search_relcache: cache replacement happend"
# in the pgpool log, you might want to increate this number.
+check_temp_table = on
+ # If on, enable temporary 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 temporary 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/pgpool.conf.sample-master-slave b/pgpool.conf.sample-master-slave
index 57c14ae99..0eb10f5d6 100644
--- a/pgpool.conf.sample-master-slave
+++ b/pgpool.conf.sample-master-slave
@@ -438,6 +438,14 @@ relcache_size = 256
# "pool_search_relcache: cache replacement happend"
# in the pgpool log, you might want to increate this number.
+check_temp_table = on
+ # If on, enable temporary 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 temporary tables
+ # and you want to save access to primary/master, you could turn this off.
+ # Default is on.
+
#------------------------------------------------------------------------------
# MEMORY CACHE
diff --git a/pgpool.conf.sample-replication b/pgpool.conf.sample-replication
index de6e7cce0..d45049393 100644
--- a/pgpool.conf.sample-replication
+++ b/pgpool.conf.sample-replication
@@ -437,6 +437,14 @@ relcache_size = 256
# "pool_search_relcache: cache replacement happend"
# in the pgpool log, you might want to increate this number.
+check_temp_table = on
+ # If on, enable temporary 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 temporary tables
+ # and you want to save access to primary/master, you could turn this off.
+ # Default is on.
+
#------------------------------------------------------------------------------
# MEMORY CACHE
diff --git a/pgpool.conf.sample-stream b/pgpool.conf.sample-stream
index 9192e3039..5137b3bf1 100644
--- a/pgpool.conf.sample-stream
+++ b/pgpool.conf.sample-stream
@@ -437,6 +437,14 @@ relcache_size = 256
# "pool_search_relcache: cache replacement happend"
# in the pgpool log, you might want to increate this number.
+check_temp_table = on
+ # If on, enable temporary 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 temporary tables
+ # and you want to save access to primary/master, you could turn this off.
+ # Default is on.
+
#------------------------------------------------------------------------------
# MEMORY CACHE
diff --git a/pool_config.c b/pool_config.c
index 4036a0dc0..b2c3d4247 100644
--- a/pool_config.c
+++ b/pool_config.c
@@ -1939,6 +1939,7 @@ int pool_init_config(void)
pool_config->debug_level = 0;
pool_config->relcache_expire = 0;
pool_config->relcache_size = 256;
+ pool_config->check_temp_table = 1;
pool_config->lists_patterns = NULL;
pool_config->pattc = 0;
pool_config->current_pattern_size = 0;
@@ -3695,6 +3696,18 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
pool_config->relcache_size = v;
}
+ else if (!strcmp(key, "check_temp_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_temp_table = v;
+ }
+
else if (!strcmp(key, "memory_cache_enabled") &&
CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
{
diff --git a/pool_config.h b/pool_config.h
index 6d4ec74d9..760a08b85 100644
--- a/pool_config.h
+++ b/pool_config.h
@@ -184,6 +184,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 */
/* 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/pool_config.l b/pool_config.l
index b89b87970..939f1885f 100644
--- a/pool_config.l
+++ b/pool_config.l
@@ -214,6 +214,7 @@ int pool_init_config(void)
pool_config->debug_level = 0;
pool_config->relcache_expire = 0;
pool_config->relcache_size = 256;
+ pool_config->check_temp_table = 1;
pool_config->lists_patterns = NULL;
pool_config->pattc = 0;
pool_config->current_pattern_size = 0;
@@ -1970,6 +1971,18 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
pool_config->relcache_size = v;
}
+ else if (!strcmp(key, "check_temp_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_temp_table = v;
+ }
+
else if (!strcmp(key, "memory_cache_enabled") &&
CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
{
diff --git a/pool_query_context.c b/pool_query_context.c
index 8a1fd19ab..a2c3c277c 100644
--- a/pool_query_context.c
+++ b/pool_query_context.c
@@ -440,7 +440,7 @@ void pool_where_to_send(POOL_QUERY_CONTEXT *query_context, char *query, Node *no
* If temporary table is used in the SELECT,
* we prefer to send to the primary.
*/
- else if (pool_has_temp_table(node))
+ else if (pool_config->check_temp_table && pool_has_temp_table(node))
{
pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
}
[parent: 67b2f2985dd1]