pgpool2.git / summary / log / commit / refs
commit eb7f8e75283045af00d8dde0df430d3ffb046bae
Author: Muhammad Usama <m.usama@gmail.com>
Date: Thu Feb 23 16:06:05 2017 +0000
Pgpool-II should not perform ping test after bringing down the VIP
At the time de-escalation from the master watchdog node, we should not perform
the ping test to verify if the VIP was successfully brought down or not.
The reason is, if the new master watchdog node acquires the VIP while the
resigning node is still performing the de-escalation steps, then the resigning
Pgpool-II node will falsely assume that it has failed to bring down the
delegate IP, Since it will get the positive ping result from the new master node
who has already acquired the same VIP.
Secondly, not having the delegate-IP in the configuration should not be
considered as an error case by wd_IP_up() and wd_IP_down() functions.
Since there are many possible valid scenarios where a user would not want to
have a delegate-IP. So now both wd_IP_* functions return WD_OK instead of WD_ND
when delegate_IP configuration is empty.
This issue was reported by the reporter of
bug:[pgpool-II 0000249]: watchdog sometimes fails de-escalation
The commit also contains some log message fixes.
src/watchdog/wd_escalation.c | 2 +-
src/watchdog/wd_if.c | 58 +++++++++++++++++++++-----------------------
2 files changed, 28 insertions(+), 32 deletions(-)
diff --git a/src/watchdog/wd_escalation.c b/src/watchdog/wd_escalation.c
index 24bb577b3..239bc8474 100644
--- a/src/watchdog/wd_escalation.c
+++ b/src/watchdog/wd_escalation.c
@@ -137,7 +137,7 @@ fork_escalation_process(void)
{
if (wd_IP_up() != WD_OK)
ereport(WARNING,
- (errmsg("watchdog de-escalation failed to bring down delegate IP")));
+ (errmsg("watchdog escalation failed to acquire delegate IP")));
}
exit(0);
diff --git a/src/watchdog/wd_if.c b/src/watchdog/wd_if.c
index 9ab451b50..e92f4a377 100644
--- a/src/watchdog/wd_if.c
+++ b/src/watchdog/wd_if.c
@@ -107,7 +107,11 @@ wd_IP_up(void)
int i;
if (strlen(pool_config->delegate_IP) == 0)
- return WD_NG;
+ {
+ ereport(LOG,
+ (errmsg("trying to acquire the delegate IP address, but delegate IP is not configured")));
+ return WD_OK;
+ }
command = wd_get_cmd(pool_config->if_up_cmd);
if (command)
@@ -119,8 +123,8 @@ wd_IP_up(void)
else
{
ereport(LOG,
- (errmsg("watchdog failed to bring up delegate IP"),
- errdetail("command not found in if_up_cmd:\"%s\" configuration",pool_config->if_up_cmd)));
+ (errmsg("failed to acquire the delegate IP address"),
+ errdetail("unable to parse the if_up_cmd:\"%s\"",pool_config->if_up_cmd)));
return WD_NG;
}
@@ -137,8 +141,8 @@ wd_IP_up(void)
{
rtn = WD_NG;
ereport(LOG,
- (errmsg("watchdog failed to bring up delegate IP"),
- errdetail("command not found in arping_cmd:\"%s\" configuration",pool_config->arping_cmd)));
+ (errmsg("failed to acquire the delegate IP address"),
+ errdetail("unable to parse the arping_cmd:\"%s\"",pool_config->arping_cmd)));
}
}
@@ -149,7 +153,7 @@ wd_IP_up(void)
if (wd_is_ip_exists(pool_config->delegate_IP) == true)
break;
ereport(LOG,
- (errmsg("watchdog bringing up delegate IP"),
+ (errmsg("waiting for the delegate IP address to become active"),
errdetail("waiting... count: %d", i+1)));
}
@@ -159,24 +163,28 @@ wd_IP_up(void)
if (rtn == WD_OK)
ereport(LOG,
- (errmsg("watchdog bringing up delegate IP, 'if_up_cmd' succeeded")));
+ (errmsg("successfully acquired the delegate IP:\"%s\"",pool_config->delegate_IP),
+ errdetail("'if_up_cmd' returned with success")));
else
- ereport(WARNING,
- (errmsg("watchdog failed to bring up delegate IP, 'if_up_cmd' failed")));
+ ereport(LOG,
+ (errmsg("failed to acquire the delegate IP address"),
+ errdetail("'if_up_cmd' failed")));
return rtn;
}
-#define WD_TRY_PING_AT_IPDOWN 3
int
wd_IP_down(void)
{
int rtn = WD_OK;
char path[WD_MAX_PATH_LEN];
char* command;
- int i;
if (strlen(pool_config->delegate_IP) == 0)
- return WD_NG;
+ {
+ ereport(LOG,
+ (errmsg("trying to release the delegate IP address, but delegate IP is not configured")));
+ return WD_OK;
+ }
command = wd_get_cmd(pool_config->if_down_cmd);
if (command)
@@ -188,34 +196,22 @@ wd_IP_down(void)
else
{
ereport(LOG,
- (errmsg("watchdog failed to bring down delegate IP"),
- errdetail("command not found in if_down_cmd:\"%s\" configuration",pool_config->if_down_cmd)));
+ (errmsg("failed to release the delegate IP address"),
+ errdetail("unable to parse the if_down_cmd:\"%s\"",pool_config->if_down_cmd)));
return WD_NG;
}
-
- if (rtn == WD_OK)
- {
- for (i = 0; i < WD_TRY_PING_AT_IPDOWN; i++)
- {
- if (wd_is_ip_exists(pool_config->delegate_IP) == false)
- break;
- }
-
- if (i >= WD_TRY_PING_AT_IPDOWN)
- rtn = WD_NG;
- }
-
if (rtn == WD_OK)
{
ereport(LOG,
- (errmsg("watchdog bringing down delegate IP"),
- errdetail("if_down_cmd succeeded")));
+ (errmsg("successfully released the delegate IP:\"%s\"",pool_config->delegate_IP),
+ errdetail("'if_down_cmd' returned with success")));
}
else
{
- ereport(WARNING,
- (errmsg("watchdog bringing down delegate IP, if_down_cmd failed")));
+ ereport(LOG,
+ (errmsg("failed to release the delegate IP:\"%s\"",pool_config->delegate_IP),
+ errdetail("'if_down_cmd' failed")));
}
return rtn;
}
[parent: 6ab5cecf7a7d]