pgpool2.git / summary / log / commit / refs
commit ef4786bdb8fec9fe9b586457c014907f2595675b
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Thu Jul 05 08:29:02 2012 +0000
Do not cache if SELECT starts with "/*NO QUERY CACHE*/" comment.
doc/pgpool-en.html | 3 ++-
doc/pgpool-ja.html | 3 ++-
pool_memqcache.c | 6 ++++++
pool_memqcache.h | 3 +++
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html
index a4b2590b1..65482a0dc 100644
--- a/doc/pgpool-en.html
+++ b/doc/pgpool-en.html
@@ -7,7 +7,7 @@
</head>
<!-- hhmts start -->
-Last modified: Sun Jun 24 19:10:17 JST 2012
+Last modified: Thu Jul 5 17:24:41 JST 2012
<!-- hhmts end -->
<body bgcolor="#ffffff">
@@ -2586,6 +2586,7 @@ Not All of SELECTs and WITH can be cached. In some cases including followings,
cache is avoided to keep consistency between caches and databases.
</p>
<ul>
+ <li>SELECT starting with "/*NO QUERY CACHE*/" comment</li>
<li>SELECT including tables in <a href="#BLACK_MEMQCACHE_TABLE_LIST">black_memqcache_table_list</a></li>
<li>SELECT FOR SHARE / UPDATE</li>
<li>SELECT including un-immutable funcsions</li>
diff --git a/doc/pgpool-ja.html b/doc/pgpool-ja.html
index 62ad20fc3..cd2d57278 100644
--- a/doc/pgpool-ja.html
+++ b/doc/pgpool-ja.html
@@ -8,7 +8,7 @@
<body>
<!-- hhmts start -->
-Last modified: Sun Jun 24 19:10:33 JST 2012
+Last modified: Thu Jul 5 17:28:23 JST 2012
<!-- hhmts end -->
<body bgcolor="#ffffff">
@@ -2711,6 +2711,7 @@ memcached$B$r%-%c%C%7%e%9%H%l!<%8$K;HMQ$9$k>l9g$O!"%M%C%H%o!<%/%"%/%;%9$N%*!<%P
</p>
<ul>
<li> <a href="#BLACK_MEMQCACHE_TABLE_LIST">black_memqcache_table_list</a>$B$G;XDj$5$l$F$$$k%F!<%V%k$r;H$C$F$$$k(BSELECT</li>
+ <li>$B!V(B/*NO QUERY CACHE*/$B!W%3%a%s%H$G;O$^$k(BSELECT</li>
<li>SELECT FOR SHARE$B$^$?$O(BUPDATE</li>
<li>IMMUTABLE$B$G$J$$4X?t$r;H$C$F$$$k(BSELECT</li>
<li>$B0l;~%F!<%V%k$r;H$C$F$$$k(BSELECT</li>
diff --git a/pool_memqcache.c b/pool_memqcache.c
index ca7815baf..42bbb5eab 100644
--- a/pool_memqcache.c
+++ b/pool_memqcache.c
@@ -668,6 +668,12 @@ bool pool_is_allow_to_cache(Node *node, char *query)
int num_oids = -1;
SelectContext ctx;
+ /*
+ * If NO QUERY CACHE coment exists, do not cache.
+ */
+ if (!strncasecmp(query, NO_QUERY_CACHE, NO_QUERY_CACHE_COMMENT_SZ))
+ return false;
+
stmt = (SelectStmt *)node;
/*
diff --git a/pool_memqcache.h b/pool_memqcache.h
index 2a2d19b16..281b6cb46 100644
--- a/pool_memqcache.h
+++ b/pool_memqcache.h
@@ -29,6 +29,9 @@
#include "pool.h"
#include <sys/time.h>
+#define NO_QUERY_CACHE "/*NO QUERY CACHE*/"
+#define NO_QUERY_CACHE_COMMENT_SZ (sizeof(NO_QUERY_CACHE)-1)
+
#define POOL_MD5_HASHKEYLEN 32 /* MD5 hash key length */
/*
[parent: 13878e7aa404]