Skip to content

Commit

Permalink
Fix for inconsistent watchdog node_id problem in wd_cli
Browse files Browse the repository at this point in the history
In watchdog node_id = 0 was reserved for local watchdog node
before 'simplifying watchdog configuration' patch, Now the watchdog
node IDshave become consistent across the cluster, but a couple of
places in the code were still expecting that node_id = 0 would
mean local node.
  • Loading branch information
codeforall committed Dec 14, 2020
1 parent f52dfb7 commit 70e0b2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/watchdog/watchdog.c
Expand Up @@ -2235,7 +2235,7 @@ fire_node_status_event(int nodeID, int nodeStatus)
{
WatchdogNode *wdNode = NULL;

if (nodeID == 0) /* this is reserved for local node */
if (g_cluster.localNode->pgpool_node_id == nodeID)
{
wdNode = g_cluster.localNode;
}
Expand Down Expand Up @@ -3635,7 +3635,7 @@ static JsonNode * get_node_list_json(int id)
/* add the array */
jw_start_array(jNode, "WatchdogNodes");

if (id == 0)
if (id == g_cluster.localNode->pgpool_node_id)
{
/* add the local node info */
add_nodeinfo_to_json(jNode, g_cluster.localNode);
Expand Down
2 changes: 1 addition & 1 deletion src/watchdog/wd_lifecheck.c
Expand Up @@ -890,7 +890,7 @@ check_pgpool_status_by_query(void)
continue;
node->nodeState = NODE_DEAD;
/* It's me! */
if (i == 0)
if (i == pool_config->pgpool_node_id)
inform_node_status(node, "parent process is dead");
else
inform_node_status(node, "unable to connect to node");
Expand Down

0 comments on commit 70e0b2b

Please sign in to comment.