pgpool2.git / summary / log / commit / refs
commit 0961c89948d4f4556c666e1631c7f957dfd6b768
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Wed May 26 06:21:25 2010 +0000
Refactoring pool.h
- Remove long standing comment out lines
- Move pool_relcache.c pool_lobj extern declarations to separate
header files
pool.h | 19 -------------------
pool_lobj.c | 2 ++
pool_lobj.h | 32 ++++++++++++++++++++++++++++++++
pool_process_query.c | 2 ++
pool_proto_modules.c | 1 +
pool_relcache.c | 1 +
pool_relcache.h | 38 ++++++++++++++++++++++++++++++++++++++
pool_timestamp.c | 1 +
8 files changed, 77 insertions(+), 19 deletions(-)
diff --git a/pool.h b/pool.h
index 5de42d82e..186148088 100644
--- a/pool.h
+++ b/pool.h
@@ -384,11 +384,6 @@ typedef struct {
} POOL_RELCACHE;
-#ifdef NOT_USED
-#define NUM_BACKENDS (in_load_balance? (selected_slot+1) : \
- (((!REPLICATION && !PARALLEL_MODE)||master_slave_dml)? Req_info->master_node_id+1: \
- pool_config->backend_desc->num_backends))
-#endif
/* NUM_BACKENDS now always returns actual number of backends if not in_load_balance */
#define NUM_BACKENDS (in_load_balance ? (selected_slot+1) : pool_config->backend_desc->num_backends)
#define BACKEND_INFO(backend_id) (pool_config->backend_desc->backend_info[(backend_id)])
@@ -404,14 +399,12 @@ typedef struct {
#define MASTER_CONNECTION(p) ((p)->slots[MASTER_NODE_ID])
#define MASTER_NODE_ID (in_load_balance? selected_slot : Req_info->master_node_id)
#define IS_MASTER_NODE_ID(node_id) (MASTER_NODE_ID == (node_id))
-//#define SECONDARY_CONNECTION(p) ((p)->slots[1])
#define REPLICATION (pool_config->replication_enabled)
#define MASTER_SLAVE (pool_config->master_slave_enabled)
#define DUAL_MODE (REPLICATION || MASTER_SLAVE)
#define PARALLEL_MODE (pool_config->parallel_mode)
#define RAW_MODE (!REPLICATION && !PARALLEL_MODE && !MASTER_SLAVE)
#define MASTER(p) MASTER_CONNECTION(p)->con
-//#define SECONDARY(p) SECONDARY_CONNECTION(p)->con
#define MAJOR(p) MASTER_CONNECTION(p)->sp->major
#define TSTATE(p) MASTER(p)->tstate
#define SYSDB_INFO (system_db_info->info)
@@ -707,16 +700,4 @@ extern POOL_STATUS do_command(POOL_CONNECTION *frontend, POOL_CONNECTION *backen
extern POOL_STATUS do_query(POOL_CONNECTION *backend, char *query, POOL_SELECT_RESULT **result, int major);
extern void free_select_result(POOL_SELECT_RESULT *result);
-/* pool_relcache.c */
-extern POOL_RELCACHE *pool_create_relcache(int cachesize, char *sql,
- func_ptr register_func, func_ptr unregister_func,
- bool issessionlocal);
-extern void pool_discard_relcache(POOL_RELCACHE *relcache);
-extern void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backend, char *table);
-extern void *int_register_func(POOL_SELECT_RESULT *res);
-extern void *int_unregister_func(void *data);
-
-/* pool_lobj.c */
-extern char *pool_rewrite_lo_creat(char kind, char *packet, int packet_len, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, int* len);
-
#endif /* POOL_H */
diff --git a/pool_lobj.c b/pool_lobj.c
index 68213564f..8b6c632bf 100644
--- a/pool_lobj.c
+++ b/pool_lobj.c
@@ -29,6 +29,8 @@
#include <netinet/in.h>
#include "pool.h"
+#include "pool_lobj.h"
+#include "pool_relcache.h"
/*
* Rewrite lo_creat call to lo_create call if:
diff --git a/pool_lobj.h b/pool_lobj.h
new file mode 100644
index 000000000..c0de4d388
--- /dev/null
+++ b/pool_lobj.h
@@ -0,0 +1,32 @@
+/* -*-pgsql-c-*- */
+/*
+ *
+ * $Header$
+ *
+ * pgpool: a language independent connection pool server for PostgreSQL
+ * written by Tatsuo Ishii
+ *
+ * Copyright (c) 2003-2010 PgPool Global Development Group
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear in all
+ * copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of the
+ * author not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. The author makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * pool_lobj.h.: pool_lobj.c related header file
+ *
+ */
+
+#ifndef POOL_LOBJ_H
+#define POOL_LOBJ_H
+#include "pool.h"
+
+extern char *pool_rewrite_lo_creat(char kind, char *packet, int packet_len, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, int* len);
+
+#endif /* POOL_LOBJ_H */
diff --git a/pool_process_query.c b/pool_process_query.c
index 33883b6c2..e0f2e94d2 100644
--- a/pool_process_query.c
+++ b/pool_process_query.c
@@ -45,6 +45,8 @@
#include "pool_signal.h"
#include "pool_timestamp.h"
#include "pool_proto_modules.h"
+#include "pool_lobj.h"
+#include "pool_relcache.h"
#ifndef FD_SETSIZE
#define FD_SETSIZE 512
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
index 2988ab529..f7ac009d8 100644
--- a/pool_proto_modules.c
+++ b/pool_proto_modules.c
@@ -47,6 +47,7 @@
#include "pool_signal.h"
#include "pool_timestamp.h"
#include "pool_proto_modules.h"
+#include "pool_relcache.h"
#include "parser/pool_string.h"
int force_replication;
diff --git a/pool_relcache.c b/pool_relcache.c
index bdf089032..30ff0713a 100644
--- a/pool_relcache.c
+++ b/pool_relcache.c
@@ -26,6 +26,7 @@
#include <string.h>
#include "pool.h"
+#include "pool_relcache.h"
/*
* Create relation cache
diff --git a/pool_relcache.h b/pool_relcache.h
new file mode 100644
index 000000000..e44eeda76
--- /dev/null
+++ b/pool_relcache.h
@@ -0,0 +1,38 @@
+/* -*-pgsql-c-*- */
+/*
+ *
+ * $Header$
+ *
+ * pgpool: a language independent connection pool server for PostgreSQL
+ * written by Tatsuo Ishii
+ *
+ * Copyright (c) 2003-2010 PgPool Global Development Group
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear in all
+ * copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of the
+ * author not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. The author makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * pool_relcache.h.: pool_relcache.c related header file
+ *
+ */
+
+#ifndef POOL_RELCACHE_H
+#define POOL_RELCACHE_H
+#include "pool.h"
+
+extern POOL_RELCACHE *pool_create_relcache(int cachesize, char *sql,
+ func_ptr register_func, func_ptr unregister_func,
+ bool issessionlocal);
+extern void pool_discard_relcache(POOL_RELCACHE *relcache);
+extern void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backend, char *table);
+extern void *int_register_func(POOL_SELECT_RESULT *res);
+extern void *int_unregister_func(void *data);
+
+#endif /* POOL_RELCACHE_H */
diff --git a/pool_timestamp.c b/pool_timestamp.c
index 0649b4898..172c77f60 100644
--- a/pool_timestamp.c
+++ b/pool_timestamp.c
@@ -25,6 +25,7 @@
#include "pool.h"
#include "pool_timestamp.h"
+#include "pool_relcache.h"
#include "parser/parsenodes.h"
#include "parser/gramparse.h"
#include "parser/pool_memory.h"
[parent: 9f6a57bc3b46]