pgpool2.git / summary / log / commit / refs
commit 4d253d944e6e8fa3db978d0c8a85ad17233cced7
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Wed Jun 02 09:23:22 2010 +0000
Remove LocalSessionId, which is not neccessary any more.
child.c | 2 --
pool.h | 2 --
pool_relcache.c | 16 +++++++++++++---
pool_session_context.c | 13 +++++++++++++
pool_session_context.h | 1 +
5 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/child.c b/child.c
index 23a3e3ab3..6ecdc1a1e 100644
--- a/child.c
+++ b/child.c
@@ -89,8 +89,6 @@ char remote_ps_data[NI_MAXHOST]; /* used for set_ps_display */
volatile sig_atomic_t got_sighup = 0;
-int LocalSessionId; /* Local session id */
-
/*
* child main loop
*/
diff --git a/pool.h b/pool.h
index 0684711c9..06dde8bd5 100644
--- a/pool.h
+++ b/pool.h
@@ -355,8 +355,6 @@ extern volatile sig_atomic_t exit_request;
#define QUERY_STRING_BUFFER_LEN 1024
extern char query_string_buffer[]; /* last query string sent to simpleQuery() */
-extern int LocalSessionId; /* Local session id. incremented when new frontend connected */
-
/*
* public functions
*/
diff --git a/pool_relcache.c b/pool_relcache.c
index 30ff0713a..7e44c8ebf 100644
--- a/pool_relcache.c
+++ b/pool_relcache.c
@@ -27,6 +27,7 @@
#include "pool.h"
#include "pool_relcache.h"
+#include "pool_session_context.h"
/*
* Create relation cache
@@ -97,6 +98,7 @@ void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backen
char query[1024];
POOL_SELECT_RESULT *res = NULL;
int index = 0;
+ int local_session_id;
/* Eliminate double quotes */
rel = malloc(strlen(table)+1);
@@ -105,6 +107,14 @@ void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backen
pool_error("pool_search_relcache: malloc failed");
return NULL;
}
+
+ local_session_id = pool_get_local_session_id;
+ if (local_session_id < 0)
+ {
+ pool_error("pool_search_relcache: pool_get_local_session_id failed");
+ return NULL;
+ }
+
for(i=0;*table;table++)
{
if (*table != '"')
@@ -123,7 +133,7 @@ void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backen
*/
if (relcache->cache_is_session_local)
{
- if (relcache->cache[i].session_id != LocalSessionId)
+ if (relcache->cache[i].session_id != local_session_id)
continue;
}
@@ -162,7 +172,7 @@ void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backen
*/
if (relcache->cache_is_session_local)
{
- if (relcache->cache[i].session_id != LocalSessionId)
+ if (relcache->cache[i].session_id != local_session_id)
{
index = i;
break;
@@ -186,7 +196,7 @@ void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backen
strncpy(relcache->cache[index].dbname, dbname, MAX_ITEM_LENGTH);
strncpy(relcache->cache[index].relname, rel, MAX_ITEM_LENGTH);
relcache->cache[index].refcnt = 1;
- relcache->cache[index].session_id = LocalSessionId;
+ relcache->cache[index].session_id = local_session_id;
free(rel);
/*
diff --git a/pool_session_context.c b/pool_session_context.c
index f9e0c20de..f46f83e7b 100644
--- a/pool_session_context.c
+++ b/pool_session_context.c
@@ -83,3 +83,16 @@ POOL_SESSION_CONTEXT *pool_get_session_context(void)
return session_context;
}
+/*
+ * Return local session id
+ */
+int pool_get_local_session_id(void)
+{
+ if (!session_context)
+ {
+ pool_error("pool_get_local_session_id: session context is not initialized");
+ return -1;
+ }
+
+ return session_context->process_context->local_session_id;
+}
diff --git a/pool_session_context.h b/pool_session_context.h
index 4e335a0d7..8a171b885 100644
--- a/pool_session_context.h
+++ b/pool_session_context.h
@@ -53,5 +53,6 @@ typedef struct {
extern void pool_init_session_context(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
extern POOL_SESSION_CONTEXT *pool_get_session_context(void);
+extern int pool_get_local_session_id(void);
#endif /* POOL_SESSION_CONTEXT_H */
[parent: 69ff3352deb4]