Master/Slave detection based on variable only

Master/Slave role setting is now based on variable value only.

Replication is checked and, if working, master_id, slave_id are saved
into server struct
This commit is contained in:
MassimilianoPinto
2015-04-29 10:50:21 +02:00
parent 8bff81e0a9
commit 1755706ada

View File

@ -539,6 +539,8 @@ char *server_string;
{ {
if (strncasecmp(row[1], "OFF", 3) == 0) { if (strncasecmp(row[1], "OFF", 3) == 0) {
ismaster = 1; ismaster = 1;
} else {
isslave = 1;
} }
} }
mysql_free_result(result); mysql_free_result(result);
@ -563,7 +565,7 @@ char *server_string;
} }
/* Set the Master role */ /* Set the Master role */
if (isslave && ismaster) if (ismaster)
{ {
monitor_clear_pending_status(database, SERVER_SLAVE); monitor_clear_pending_status(database, SERVER_SLAVE);
monitor_set_pending_status(database, SERVER_MASTER); monitor_set_pending_status(database, SERVER_MASTER);