pgpool2.git / summary / log / commit / refs
commit 6368f3fc4ac59561383fdcee7fc7845f33b85fc8
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Thu Jun 28 09:06:32 2012 +0000
Fix segmentation fault that occurs when use_watchdog=off.
main.c | 18 +++++++++++-------
recovery.c | 9 ++++++---
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/main.c b/main.c
index da2f6a8f3..e91fbe876 100644
--- a/main.c
+++ b/main.c
@@ -1463,7 +1463,7 @@ void degenerate_backend_set(int *node_id_set, int count)
if (need_signal)
{
- if (WD_OK == wd_degenerate_backend_set(node_id_set, count))
+ if (!pool_config->use_watchdog || WD_OK == wd_degenerate_backend_set(node_id_set, count))
{
kill(parent, SIGUSR1);
}
@@ -1494,7 +1494,7 @@ void promote_backend(int node_id)
Req_info->node_id[0] = node_id;
pool_log("promote_backend: %d promote node request from pid %d", node_id, getpid());
- if (WD_OK == wd_promote_backend(node_id))
+ if (!pool_config->use_watchdog || WD_OK == wd_promote_backend(node_id))
{
kill(parent, SIGUSR1);
}
@@ -1517,7 +1517,7 @@ void send_failback_request(int node_id)
return;
}
- if (WD_OK != wd_send_failback_request(node_id))
+ if (pool_config->use_watchdog && WD_OK != wd_send_failback_request(node_id))
{
return;
}
@@ -1568,10 +1568,14 @@ static RETSIGTYPE exit_handler(int sig)
kill(pcp_pid, sig);
kill(worker_pid, sig);
- pool_log("watchdog_pid: %d", watchdog_pid);
-/*
- kill(watchdog_pid, sig);
-*/
+
+ if (pool_config->use_watchdog)
+ {
+ pool_log("watchdog_pid: %d", watchdog_pid);
+ /*
+ kill(watchdog_pid, sig);
+ */
+ }
POOL_SETMASK(&UnBlockSig);
diff --git a/recovery.c b/recovery.c
index 157f722e2..483325390 100644
--- a/recovery.c
+++ b/recovery.c
@@ -102,8 +102,11 @@ int start_recovery(int recovery_node)
{
pool_log("starting 2nd stage");
- /* announce start recovery */
- wd_start_recovery();
+ if (pool_config->use_watchdog)
+ {
+ /* announce start recovery */
+ wd_start_recovery();
+ }
/* 2nd stage */
*InRecovery = RECOVERY_ONLINE;
@@ -179,7 +182,7 @@ int start_recovery(int recovery_node)
void finish_recovery(void)
{
/* announce end recovery */
- if (*InRecovery == RECOVERY_ONLINE)
+ if (pool_config->use_watchdog && *InRecovery == RECOVERY_ONLINE)
{
wd_end_recovery();
}
[parent: 196e0f68929d]