Description:
According to the documentation, the mysqlrpladmin utility permits the user to specify an external script to execute before and after the switchover and failover commands and if the script returns a value other than 0, the result code is presented in an error message.
The error message is generated as described but mysqlrpladmin continues to process the switchover or failover even if the execution of the script is critical to the process.
How to repeat:
Create a script that returns a non-zero exit status.
Execute a switchover using the mysqlrpladmin utility
mysqlrpladmin switchover --verbose --discover-slaves-login=.mysqlrpladmin.cnf[white-fog] --master=.mysqlrpladmin.cnf[white-fog] --new-master=.mysqlrpladmin.cnf[calm-shape] --demote-master --rpl-user=SUSR_Repl:redacted --log=mysqlrpladmin.log --timeout=5 --exec-before $HOME/test.sh --exec-after $HOME/test.sh
Observe error messages and that mysqlrpladmin continues to process the switchover.
...
# Spawning external script.
# SCRIPT EXECUTED: ['/home/msolomon/test.sh', 'white-fog', '3306', 'calm-shape', '3306']
ERROR: test.sh Script failed. Result = 1
# Blocking writes on master.
# LOCK STRING: FLUSH TABLES WITH READ LOCK
...
# Executing start on slave white-fog:3306 Ok
# Spawning external script.
# SCRIPT EXECUTED: ['/home/msolomon/test.sh', 'calm-shape', '3306']
ERROR: test.sh Script failed. Result = 1
# Checking slaves for errors.
...
Suggested fix:
Abort without making any changes if before-script fails.
Abort but leave the new master in read-only state if after-script fails.