Description:
The mysqlrpladmin failover command does not properly detect the master in the candidates list and uses it as the new master.
How to repeat:
Run a failover with the master server in the slaves list and in the candidates list and confirm that it aborts.
For example, with damp-bonus as the master
mysqlrpladmin failover --slaves=damp-bonus,dry-mountain,winter-rice,green-bar,wandering-field,billowing-rice --candidates=damp-bonus,dry-mountain,winter-rice,green-bar,wandering-field,billowing-rice
# Checking privileges.
# Checking privileges on candidates.
# Performing failover.
# Checking eligibility of slave damp-bonus:3306 for candidate.
# GTID_MODE=ON ... Ok
WARNING: IP lookup by name failed for damp-bonus,reason: Resolver Error 0 (no error)
# Replication user exists ... Ok
# Candidate slave damp-bonus:3306 will become the new master.
# Checking slaves status (before failover).
# ERROR: Server 'damp-bonus@3306' is not acting as a slave.
ERROR: Server 'damp-bonus@3306' is not acting as a slave. Note: To ignore this issue use the utility with the --force option.
Run a failover with the master in the candidates list but not in the slaves list and observe that it does not abort.
For example, with damp-bonus as the master
mysqlrpladmin failover --slaves=shrill-band,dry-mountain,winter-rice,green-bar,wandering-field,billowing-rice --candidates=damp-bonus,dry-mountain,winter-rice,green-bar,wandering-field,billowing-rice
# Checking privileges.
# Checking privileges on candidates.
# Performing failover.
# Checking eligibility of slave damp-bonus:3306 for candidate.
# GTID_MODE=ON ... Ok
WARNING: IP lookup by name failed for damp-bonus,reason: Resolver Error 0 (no error)
# Replication user exists ... Ok
# Candidate slave damp-bonus:3306 will become the new master.
# Checking slaves status (before failover).
# Preparing candidate for failover.
…
Suggested fix:
Option to consider
* check for the master in the candidates validation code similar to the check in the slaves validation code
* compare the slaves list with the candidates list and make sure the candidates list is a subset of the slaves list
* don't use any candidates that are not on the slaves list