[pgpool-general-jp: 251] Re: pgpoolの縮退運転について
Yoshiyuki Asaba
y-asaba @ sraoss.co.jp
2007年 9月 14日 (金) 15:51:34 JST
浅羽です。
From: "吉元良史" <y-yoshi @ wit.co.jp>
Subject: [pgpool-general-jp: 250] pgpoolの縮退運転について
Date: Thu, 13 Sep 2007 15:25:38 +0900
> テストにて手動でpc2のPostgreSQLを停止した後、最初にSELECT文を発行した時にフリーズしてしまいます。
手元でも再現させることができました。
添付のパッチで症状は改善されるでしょうか?
configure のあるディレクトリにコピーして
% patch < diff
% make install
してみてください。よろしくお願いします。
--
Yoshiyuki Asaba
y-asaba @ sraoss.co.jp
-------------- next part --------------
Index: child.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/child.c,v
retrieving revision 1.5.2.4
diff -u -r1.5.2.4 child.c
--- child.c 10 Sep 2007 13:34:38 -0000 1.5.2.4
+++ child.c 14 Sep 2007 06:49:48 -0000
@@ -66,7 +66,6 @@
static int send_params(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
static void send_frontend_exits(void);
static int s_do_auth(POOL_CONNECTION_POOL_SLOT *cp, char *password);
-static int select_load_balancing_node(void);
/*
* non 0 means SIGTERM(smart shutdown) or SIGINT(fast shutdown) has arrived
@@ -1646,7 +1645,7 @@
/*
* Select load balancing node
*/
-static int select_load_balancing_node(void)
+int select_load_balancing_node(void)
{
double total_weight,r;
int i;
Index: pool.h
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool.h,v
retrieving revision 1.5.2.5
diff -u -r1.5.2.5 pool.h
--- pool.h 26 Jul 2007 09:03:04 -0000 1.5.2.5
+++ pool.h 14 Sep 2007 06:49:48 -0000
@@ -383,6 +383,7 @@
extern int pool_get_config(char *confpath);
extern void do_child(int unix_fd, int inet_fd);
extern void pcp_do_child(int unix_fd, int inet_fd, char *pcp_conf_file);
+extern int select_load_balancing_node(void);
extern int pool_init_cp(void);
extern POOL_STATUS pool_process_query(POOL_CONNECTION *frontend,
POOL_CONNECTION_POOL *backend,
Index: pool_process_query.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_process_query.c,v
retrieving revision 1.23.2.14
diff -u -r1.23.2.14 pool_process_query.c
--- pool_process_query.c 29 Aug 2007 05:53:41 -0000 1.23.2.14
+++ pool_process_query.c 14 Sep 2007 06:49:51 -0000
@@ -283,6 +283,12 @@
num_fds = 0;
+ if (!VALID_BACKEND(backend->info->load_balancing_node))
+ {
+ /* select load balancing node */
+ backend->info->load_balancing_node = select_load_balancing_node();
+ }
+
for (i=0;i<NUM_BACKENDS;i++)
{
if (VALID_BACKEND(i))
@@ -322,6 +328,8 @@
if (detect_postmaster_down_error(CONNECTION(backend, i), MAJOR(backend)))
{
was_error = 1;
+ if (!VALID_BACKEND(i))
+ break;
notice_backend_error(i);
sleep(5);
break;
@@ -346,9 +354,9 @@
status = ProcessFrontendResponse(frontend, backend);
if (status != POOL_CONTINUE)
return status;
-
- continue;
}
+ if (kind == 0)
+ continue;
}
if (FD_ISSET(MASTER(backend)->fd, &exceptmask))
pgpool-general-jp メーリングリストの案内