MXS-2446 Ensure that the URLs reflects m_nodes_by_id
If code that may remove items from m_nodes_by_id (Clustrix nodes keyed by id) succeeds, we must update the vector of health check URLs also in the case that code that _may_ add items to m_nodes_by_id fails.
This commit is contained in:
@ -408,11 +408,7 @@ void ClustrixMonitor::tick()
|
|||||||
|
|
||||||
case http::Async::READY:
|
case http::Async::READY:
|
||||||
update_server_statuses();
|
update_server_statuses();
|
||||||
|
|
||||||
if (!m_health_urls.empty())
|
|
||||||
{
|
|
||||||
make_health_check();
|
make_health_check();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +739,6 @@ bool ClustrixMonitor::refresh_nodes(MYSQL* pHub_con)
|
|||||||
node.set_running(false, ClustrixNode::APPROACH_OVERRIDE);
|
node.set_running(false, ClustrixNode::APPROACH_OVERRIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_http_urls();
|
|
||||||
cluster_checked();
|
cluster_checked();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -757,6 +752,11 @@ bool ClustrixMonitor::refresh_nodes(MYSQL* pHub_con)
|
|||||||
MXS_ERROR("%s: Could not execute '%s' on %s: %s",
|
MXS_ERROR("%s: Could not execute '%s' on %s: %s",
|
||||||
name(), ZQUERY, mysql_get_host_info(pHub_con), mysql_error(pHub_con));
|
name(), ZQUERY, mysql_get_host_info(pHub_con), mysql_error(pHub_con));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we are here, the call above to check_cluster_membership() succeeded. As that
|
||||||
|
// function may change the content of m_nodes_by_ids, we must always update the urls,
|
||||||
|
// irrespective of whether the SQL of this function succeeds or not.
|
||||||
|
update_http_urls();
|
||||||
}
|
}
|
||||||
|
|
||||||
return refreshed;
|
return refreshed;
|
||||||
@ -1112,6 +1112,7 @@ bool ClustrixMonitor::check_http(Call::action_t action)
|
|||||||
|
|
||||||
case http::Async::READY:
|
case http::Async::READY:
|
||||||
{
|
{
|
||||||
|
mxb_assert(m_health_urls == m_http.urls());
|
||||||
// There are as many results as there are nodes,
|
// There are as many results as there are nodes,
|
||||||
// and the results are in node order.
|
// and the results are in node order.
|
||||||
const vector<http::Result>& results = m_http.results();
|
const vector<http::Result>& results = m_http.results();
|
||||||
|
|||||||
Reference in New Issue
Block a user