9 Commits

Author SHA1 Message Date
Johan Wikman
8d1c4bdd56 MXS-1441 Use monitor_launch_script for performing switchover
To be able to do that, we need to get hold of the MXS_MONITORED_SERVER
corresponding to the SERVER specified as the new master.

So, instead of just return a boolean indicating whether the server was
found or not we return the MXS_MONITORED_SERVER pointer.
2017-10-03 09:28:42 +03:00
Johan Wikman
f29d8209cc MXS-1441 Create proper json error objects 2017-10-02 16:08:12 +03:00
Johan Wikman
438b4e0341 Merge branch '2.2' into 2.2-mrm 2017-10-02 15:49:08 +03:00
Johan Wikman
68432bbaa3 Rename MXS_MONITOR::databases to MXS_MONITOR::monitored_servers
More descriptive name. Some local varaibles could now also be
renamed to be more descriptive, but that's for another day.
2017-10-02 15:33:58 +03:00
Johan Wikman
8d03876e3e Rename MXS_MONITOR_SERVERS to MXS_MONITORED_SERVER
An element in a linked list is not a list.
2017-10-02 15:05:17 +03:00
Johan Wikman
a81d85fba2 MXS-1441 Add switchover logic
Switchover expects one or two servers as argument, one (the new
master) if there is no master and two (the new master, and the
current master) if there currently is a master.

The procedure is as follows:
- Stop monitor
- Check that provided arguments are reasonable.
  - If there is no master currently, then only one argument is
    accepted.
  - If there is a master, then it must also be specified.

  This is to prevent pathological cases where the situation has
  changed after the admin has issued the switchover command.
- Check the failover mode and disable it.
- Perform the failover.
- If succeeded, enable failover if it was.
- If it failed, if failover was enabled, do not enable it and log
  an alert. If failover was not enabled, just log an error.
2017-09-29 16:19:12 +03:00
Johan Wikman
f87a878073 Set monitor state before thread launch
When the monitor is started, the state is immediately updated
to running, and not only when the thread actually has started
executing.
2017-09-29 13:10:49 +03:00
Johan Wikman
89d1f81e37 Merge branch '2.2' into 2.2-mrm 2017-09-28 15:19:20 +03:00
Johan Wikman
9c60b68476 Convert mysql_mon.c to mysql_mon.cc 2017-09-28 15:17:27 +03:00