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:
@ -39,6 +39,12 @@ enum class SubState
|
||||
SubState substate_from_string(const std::string& substate);
|
||||
std::string to_string(SubState sub_state);
|
||||
|
||||
enum class Softfailed
|
||||
{
|
||||
ACCEPT,
|
||||
REJECT
|
||||
};
|
||||
|
||||
/**
|
||||
* Is a particular Clustrix node part of the quorum.
|
||||
*
|
||||
@ -66,15 +72,27 @@ inline bool is_part_of_the_quorum(const char* zName, MXS_MONITORED_SERVER& ms)
|
||||
return is_part_of_the_quorum(zName, *ms.server, ms.con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a particular Clustrix node being softfailed.
|
||||
*
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param server The server object of a Clustrix node.
|
||||
* @param pCon Valid MYSQL handle to the server.
|
||||
*
|
||||
* @return True, if the node is being softfailed, false otherwise.
|
||||
*/
|
||||
bool is_being_softfailed(const char* zName, const SERVER& server, MYSQL* pCon);
|
||||
|
||||
/**
|
||||
* Ping or create connection to server and check whether it can be used
|
||||
* as hub.
|
||||
*
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param settings Connection settings
|
||||
* @param server Server object referring to a Clustrix node.
|
||||
* @param ppCon Address of pointer to MYSQL object referring to @server
|
||||
* (@c *ppCon may also be NULL).
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param settings Connection settings
|
||||
* @param softfailed Whether a softfailed node is considered ok or not.
|
||||
* @param server Server object referring to a Clustrix node.
|
||||
* @param ppCon Address of pointer to MYSQL object referring to @server
|
||||
* (@c *ppCon may also be NULL).
|
||||
*
|
||||
* @return True, if the server can be used as hub, false otherwise.
|
||||
*
|
||||
@ -82,6 +100,7 @@ inline bool is_part_of_the_quorum(const char* zName, MXS_MONITORED_SERVER& ms)
|
||||
*/
|
||||
bool ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
Softfailed softfailed,
|
||||
SERVER& server,
|
||||
MYSQL** ppCon);
|
||||
|
||||
@ -89,17 +108,19 @@ bool ping_or_connect_to_hub(const char* zName,
|
||||
* Ping or create connection to server and check whether it can be used
|
||||
* as hub.
|
||||
*
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param settings Connection settings
|
||||
* @param ms The monitored server.
|
||||
* @param zName The name of the Clustrix monitor instance.
|
||||
* @param settings Connection settings
|
||||
* @param softfailed Whether a softfailed node is considered ok or not.
|
||||
* @param ms The monitored server.
|
||||
*
|
||||
* @return True, if the server can be used as hub, false otherwise.
|
||||
*/
|
||||
inline bool ping_or_connect_to_hub(const char* zName,
|
||||
const MXS_MONITORED_SERVER::ConnectionSettings& settings,
|
||||
Softfailed softfailed,
|
||||
MXS_MONITORED_SERVER& ms)
|
||||
{
|
||||
return ping_or_connect_to_hub(zName, settings, *ms.server, &ms.con);
|
||||
return ping_or_connect_to_hub(zName, settings, softfailed, *ms.server, &ms.con);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user