pgpool2.git / summary / log / commit / refs
commit a556b51e40fedff49749b67e7fffd37b1cd558c8
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Sun May 12 22:54:41 2013 +0000
Fix not to execute escalation when the active pgpool receives other
pgpool's server down notification.
watchdog/wd_child.c | 2 +-
watchdog/wd_lifecheck.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/watchdog/wd_child.c b/watchdog/wd_child.c
index 102192136..8d1db6892 100644
--- a/watchdog/wd_child.c
+++ b/watchdog/wd_child.c
@@ -270,7 +270,7 @@ wd_send_response(int sock, WdPacket * recv_pack)
wd_set_wd_list(p->hostname,p->pgpool_port, p->wd_port, p->delegate_ip, &(p->tv), WD_DOWN);
send_packet.packet_no = WD_READY;
memcpy(&(send_packet.wd_body.wd_info), WD_MYSELF, sizeof(WdInfo));
- if (wd_am_I_oldest() == WD_OK)
+ if (wd_am_I_oldest() == WD_OK && WD_MYSELF->status != WD_MASTER)
{
wd_escalation();
}
diff --git a/watchdog/wd_lifecheck.c b/watchdog/wd_lifecheck.c
index 623ee182b..a4575356d 100644
--- a/watchdog/wd_lifecheck.c
+++ b/watchdog/wd_lifecheck.c
@@ -120,7 +120,7 @@ wd_lifecheck(void)
pool_error("wd_lifecheck: failed to connect to any trusted servers");
/* This server connection may be downed */
- if (WD_List->status == WD_MASTER)
+ if (WD_MYSELF->status == WD_MASTER)
{
wd_IP_down();
}
@@ -139,7 +139,7 @@ wd_lifecheck(void)
check_pgpool_status();
/* I'm in down.... */
- if (WD_List->status == WD_DOWN)
+ if (WD_MYSELF->status == WD_DOWN)
{
pool_error("wd_lifecheck: watchdog status is DOWN. You need to restart this for recovery.");
}
@@ -181,9 +181,9 @@ check_pgpool_status_by_udp(void)
pool_debug("check_pgpool_status_by_udp: checking pgpool %d (%s:%d)",
cnt, p->hostname, p->pgpool_port);
- if (p == WD_List)
+ if (p == WD_MYSELF)
{
- if (is_parent_alive() == WD_NG && WD_List->status != WD_DOWN)
+ if (is_parent_alive() == WD_NG && WD_MYSELF->status != WD_DOWN)
{
pool_debug("check_pgpool_status_by_udp: NG; the main pgpool process does't exist.");
pool_log("check_pgpool_status_by_udp: lifecheck failed. pgpool %d (%s:%d) seems not to be working",
@@ -297,7 +297,7 @@ check_pgpool_status_by_query(void)
pool_config->wd_life_point, i, p->hostname, p->pgpool_port);
if ((i == 0) &&
- (WD_List->status != WD_DOWN))
+ (WD_MYSELF->status != WD_DOWN))
{
wd_set_myself(&tv, WD_DOWN);
wd_notice_server_down();
@@ -371,12 +371,14 @@ create_conn(char * hostname, int port)
return conn;
}
+/* handle other pgpool's down */
static int
pgpool_down(WdInfo * pool)
{
int rtn = WD_DOWN;
- if ((WD_List->status == WD_NORMAL) &&
+ /* the active pgpool goes down */
+ if ((WD_MYSELF->status == WD_NORMAL) &&
(pool->status == WD_MASTER))
{
pool->status = WD_DOWN;
[parent: 40439f30d02a]