MXS-2330 Do not use softfailed node as hub

When a softfailed node is finally revoked, it will appear as the
single node in a functioning Clustrix cluster. To ensure that the
Clustrix monitor will not stick to that node, if the node that is
used as hub is softfailed, it is immediately replaced with another
node.
This commit is contained in:
Johan Wikman
2019-02-13 13:28:35 +02:00
parent 35e17d9878
commit 5c34550b40
5 changed files with 138 additions and 32 deletions

View File

@ -81,9 +81,9 @@ private:
void tick() override;
void check_hub_and_refresh_nodes();
void check_hub();
void choose_hub();
void check_cluster(Clustrix::Softfailed softfailed);
void check_hub(Clustrix::Softfailed softfailed);
void choose_hub(Clustrix::Softfailed softfailed);
void refresh_nodes();
bool check_cluster_membership(std::map<int, ClustrixMembership>* pMemberships);
@ -107,6 +107,21 @@ private:
json_t** ppError);
bool should_check_cluster() const
{
return now() - m_last_cluster_check > m_config.cluster_monitor_interval();
}
void trigger_cluster_check()
{
m_last_cluster_check = 0;
}
void cluster_checked()
{
m_last_cluster_check = now();
}
static long now()
{
return mxb::WorkerLoad::get_time_ms();