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:
Markus Mäkelä
2016-12-17 23:15:59 +02:00
parent 269a97b2de
commit 3509aa144c
2 changed files with 5 additions and 13 deletions

View File

@ -142,7 +142,7 @@ startMonitor(MONITOR *mon, const CONFIG_PARAMETER *params)
handle->id = MONITOR_DEFAULT_ID; handle->id = MONITOR_DEFAULT_ID;
handle->disableMasterFailback = 0; handle->disableMasterFailback = 0;
handle->availableWhenDonor = 0; handle->availableWhenDonor = 0;
handle->disableMasterRoleSetting = 0; handle->disableMasterRoleSetting = false;
handle->master = NULL; handle->master = NULL;
handle->script = NULL; handle->script = NULL;
handle->root_node_as_master = true; 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, "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, "Available when Donor:\t%s\n", (handle->availableWhenDonor == 1) ? "on" : "off");
dcb_printf(dcb, "Master Role Setting Disabled:\t%s\n", 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 */ /* get the candidate master, following MXS_MIN(node_id) rule */
candidate_master = get_candidate_master(mon); 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); handle->master = set_cluster_master(handle->master, candidate_master, master_stickiness);
}
ptr = mon->databases; ptr = mon->databases;
while (ptr) while (ptr)
{ {
const int repl_bits = (SERVER_SLAVE | SERVER_MASTER | SERVER_MASTER_STICKINESS); 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) if (ptr != handle->master)
{ {

View File

@ -55,7 +55,7 @@ typedef struct
unsigned long id; /**< Monitor ID */ unsigned long id; /**< Monitor ID */
int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */ int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */
int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */ 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 */ MONITOR_SERVERS *master; /**< Master server for MySQL Master/Slave replication */
char* script; char* script;
bool root_node_as_master; /**< Whether we require that the Master should bool root_node_as_master; /**< Whether we require that the Master should