Fix disable_master_role_setting in galeramon
The functionality to disable setting of master and slave status values to Galera nodes was broken by the change to the monitoring algorithm. The disable_master_role_setting option removed the master node which would trigger the clearing of the replication status values from the node. A more direct, and arguably better, way is to check that this option is disabled before processing the status values for the nodes.
This commit is contained in:
@ -142,7 +142,7 @@ startMonitor(MONITOR *mon, const CONFIG_PARAMETER *params)
|
||||
handle->id = MONITOR_DEFAULT_ID;
|
||||
handle->disableMasterFailback = 0;
|
||||
handle->availableWhenDonor = 0;
|
||||
handle->disableMasterRoleSetting = 0;
|
||||
handle->disableMasterRoleSetting = false;
|
||||
handle->master = NULL;
|
||||
handle->script = NULL;
|
||||
handle->root_node_as_master = true;
|
||||
@ -259,7 +259,7 @@ diagnostics(DCB *dcb, const MONITOR *mon)
|
||||
dcb_printf(dcb, "Master Failback:\t%s\n", (handle->disableMasterFailback == 1) ? "off" : "on");
|
||||
dcb_printf(dcb, "Available when Donor:\t%s\n", (handle->availableWhenDonor == 1) ? "on" : "off");
|
||||
dcb_printf(dcb, "Master Role Setting Disabled:\t%s\n",
|
||||
(handle->disableMasterRoleSetting == 1) ? "on" : "off");
|
||||
handle->disableMasterRoleSetting ? "on" : "off");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -539,22 +539,14 @@ monitorMain(void *arg)
|
||||
/* get the candidate master, following MXS_MIN(node_id) rule */
|
||||
candidate_master = get_candidate_master(mon);
|
||||
|
||||
/* Select the master, based on master_stickiness */
|
||||
if (1 == handle->disableMasterRoleSetting)
|
||||
{
|
||||
handle->master = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
handle->master = set_cluster_master(handle->master, candidate_master, master_stickiness);
|
||||
}
|
||||
|
||||
ptr = mon->databases;
|
||||
|
||||
while (ptr)
|
||||
{
|
||||
const int repl_bits = (SERVER_SLAVE | SERVER_MASTER | SERVER_MASTER_STICKINESS);
|
||||
if (SERVER_IS_JOINED(ptr->server))
|
||||
if (SERVER_IS_JOINED(ptr->server) && !handle->disableMasterRoleSetting)
|
||||
{
|
||||
if (ptr != handle->master)
|
||||
{
|
||||
|
||||
@ -55,7 +55,7 @@ typedef struct
|
||||
unsigned long id; /**< Monitor ID */
|
||||
int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */
|
||||
int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */
|
||||
int disableMasterRoleSetting; /**< Monitor flag to disable setting master role */
|
||||
bool disableMasterRoleSetting; /**< Monitor flag to disable setting master role */
|
||||
MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave replication */
|
||||
char* script;
|
||||
bool root_node_as_master; /**< Whether we require that the Master should
|
||||
|
||||
Reference in New Issue
Block a user