168 Commits

Author SHA1 Message Date
Johan Wikman
dc47835ef6 MXS-1775 Add documentation for new monitor parameter 2018-06-06 15:25:57 +03:00
Johan Wikman
af717426d5 MXS-1775 Load server journal unconditionally
The server journal is unconditionally loaded and need not be
done in @c pre_loop.
2018-06-06 15:25:57 +03:00
Johan Wikman
f600b3a769 MXS-1775 Check disk space in MariaDBMonitor 2018-06-06 15:25:57 +03:00
Johan Wikman
18ece193bb MXS-1775 MariaDBMonitor::main() removed
Now uses MonitorInstance::main() as all other monitors.
2018-06-06 15:25:57 +03:00
Johan Wikman
44b1e805a3 MXS-1775 Move MariaDBMonitor functionality to tick
Now all is set for moving MariaDBMonitor on top of
MonitorInstance::main.
2018-06-06 15:25:57 +03:00
Johan Wikman
329a6df662 MXS-1775 Factor out post-processing
Further adjustments for being able to move MariaDBMonitor on
top of MonitorInstance::main().
2018-06-06 15:25:57 +03:00
Johan Wikman
71194d83d3 MXS-1775 Rearrange for moving main loop to MonitorInstance
This is another step in the process for moving the main loop
from MariaDBMonitor to MonitorInstance.
2018-06-06 15:25:57 +03:00
Markus Mäkelä
70fdd0fc17
Merge branch '2.2' into develop 2018-06-06 08:56:31 +03:00
Markus Mäkelä
f2b2951c99
Track the number of performed monitoring intervals
Tracking how many times the monitor has performed its monitoring allows
the test framework to consistently wait for an event instead of waiting
for a hard-coded time period. The MaxCtrl `api get` command can be used to
easily extract the numeric value.
2018-06-06 08:46:46 +03:00
Esa Korhonen
7cd19a12a2 MXS-1883 Remove locking during monitor loop
Since the admin cannot modify server states any more, the locks are not
required.
2018-06-01 15:03:07 +03:00
Esa Korhonen
37841183b3 Cleanup server.h
Renamed, rearranged and clarified status bits. Removed unused macros.
2018-06-01 14:29:51 +03:00
Esa Korhonen
4d7aff4ab9 MXS-1845 Find strongly connected components with multiple slave connections
Rewrote the algorithm for clarity.
2018-06-01 14:04:50 +03:00
Johan Wikman
32c7ae2f9f MXS-1775 Inherit MariaDBMonitor from mxs::MonitorInstance
Start/stop now provided by MonitorInstance. The thread main
function is now virtual and overriden by MariaDBMonitor. Some
additional refactoring is necessary in order to be able to allow
MonitorInstance to handle the main loop.
2018-06-01 13:48:15 +03:00
Johan Wikman
5219245a04 MXS-1775 Reset server info in MariaDBMonitor::configure()
That way, MariaDBMonitor no longer needs a custome start() function.
2018-06-01 13:48:15 +03:00
Johan Wikman
be3bdc7bc9 MXS-1775 Rename MariaDBMonitor::main_loop() to main()
To make it compatible with mxs::MonitorInstance.
2018-06-01 13:48:15 +03:00
Johan Wikman
a82c5911e5 MXS-1775 Rename m_monitor_base to m_monitor
To make it compatible with how the variable is named
in maxscale::MonitorInstance.
2018-06-01 13:48:15 +03:00
Johan Wikman
f862939dd7 MXS-1775 Make MariaDBMon non-dependent on stop() return value
To align it with the behavour or MonitorInstance::stop()
2018-06-01 13:48:15 +03:00
Johan Wikman
62f3e89ae7 MXS-1775 Tilt MariaDbMon towards maxscale::MonitorInstance
- m_status -> m_state
- m_keep_running -> m_shutdown
- load_config_params() -> configure()
2018-06-01 13:48:15 +03:00
Johan Wikman
b439857a84 MXS-1775 Remove destroy()
Now the instance is deleted simply by deleting it.
2018-06-01 13:48:15 +03:00
Esa Korhonen
c039821467 MXS-1883 Maintenance is now the only user-modifiable bit for a monitored server
The request to turn maintenance off/on is a separate flag, although the actual
status is still contained in the status bitfield.
2018-05-30 10:09:15 +03:00
Esa Korhonen
3ec449339f Only write to SERVER->status at the end of a monitoring loop
This makes the code clearer and reduces race conditions, as the monitor
could be writing SERVER->status while a router is reading it. Also,
the time during which the SERVER struct is locked drops to a fraction.
2018-05-23 16:19:08 +03:00
Esa Korhonen
4788c4947d Merge branch 'read_only' into develop
develop was updated before a merge was pushed, requiring a second merge.
2018-05-18 16:51:38 +03:00
Esa Korhonen
709c076000 Merge branch '2.2' into develop 2018-05-18 16:31:49 +03:00
Johan Wikman
d5871e48ae MXS-1775 Change assumption of Monitor::destroy() function
Used to be assumed to be a static member function, now assumed
to be a regular member function.
2018-05-18 16:00:05 +03:00
Esa Korhonen
fb56de641a MXS-1859 Add options for enforcing read_only on slaves
If the feature is enabled (default off), at the end of a monitor loop
(once server states are known), read_only is enabled on slaves servers
without it.
2018-05-18 15:29:56 +03:00
Esa Korhonen
45da5a08d9 MXS-1845 Cleanup monitor backend updating
Now detects errors and prints them.
2018-05-18 13:48:08 +03:00
Esa Korhonen
654b5f1958 MXS-1865 Wrong permissions on backends no longer cause monitor start to fail
The logic was weird, as the permission checking function assumes a disconnected
server as fine. The checking is now done when starting the main loop and lacking
grants print errors but does not stop the monitor.
2018-05-16 13:55:45 +03:00
Esa Korhonen
b71710e066 MXS-1865 Combine server version and type
Binlog server is now handled better.
2018-05-16 13:55:45 +03:00
Esa Korhonen
df4454027a Clean up monitor initialization and destruction
Since monitors are now freed at MaxScale exit, the server data should be freed. Also,
gtid domain variables are now initialized with a common constant.
2018-05-14 11:32:02 +03:00
Esa Korhonen
97328a61f0 Use MonitorApi in MariaDBMonitor 2018-05-14 11:11:08 +03:00
Esa Korhonen
b92284afc4 Move server querying to MariaDBServer
The query functions still require the base monitor struct because of
mon_ping_or_connect_to_db().
2018-05-14 11:11:08 +03:00
Esa Korhonen
38647a0c69 Increase monitor sleep accuracy
Now the last sleep of a monitor loop is of correct duration.
2018-05-14 11:11:08 +03:00
Esa Korhonen
0b459c0496 Always check monitor permissions when starting monitor
Servers could have been added while monitor was down so better be on the safe side.
2018-05-14 11:11:08 +03:00
Esa Korhonen
39789c19d3 MXS-1856 Do not set read_only OFF if join_cluster() fails
This could in some cases leave read_only OFF even if the target slave
begins replication.
2018-05-08 13:56:57 +03:00
Johan Wikman
44fa2a4be2 MXS-1848 Change prototype of startMonitor
StartMonitor() now takes a MXS_MONITOR_INSTANCE and returns
true, if the monitor could be started and false otherwise.
So, the setup is such that in createInstance(), the instance
data is created and then using startMonitor() and stopMonitor()
the monitor is started/stopped. Finally in destroyInstance(),
the actual instance data is deleted.
2018-05-07 14:08:36 +03:00
Johan Wikman
5c1083c4aa MXS-1848 Parameters are not available at createInstance time
The monitor parameters are not available when the monitor instance
is created so at least for the time being they are removed from
the API.
2018-05-07 14:08:36 +03:00
Johan Wikman
81654fb0e7 MXS-1848 Rename monitor types and instance variable
The following type name changes

  MXS_MONITOR_OBJECT   -> MXS_MONITOR_API
  MXS_SPECIFIC_MONITOR -> MXS_MONITOR_INSTANCE

Further, the 'handle' instance variable of what used to be
called MXS_MONITOR_OBJECT has been renamed to 'api'.

An example, what used to look like

   mon->module->stopMonitor(mon->handle);

now looks like

  mon->api->stopMonitor(mon->instance);

which makes it more obvious what is going on.
2018-05-07 14:08:36 +03:00
Johan Wikman
510eb7ec7c MXS-1848 Change monitorCamelCase to monitor_snake_case 2018-05-07 14:08:36 +03:00
Johan Wikman
60228f0f26 MXS-1848 Implement createInstance() and destroyInstance()
CreateInstance() (renamed from initMonitor()) and destroyInstance()
(renamed from finishMonitor()) have now tentatively been
implemented for all monitors.

Next step is to

1) change the prototype of startMonitor() to

       bool (*startMonitor)(MXS_SPECIFIC_MONITOR*,
                            const MXS_MONITOR_PARAMETER*);

   and assume that mon->handle will always contain the
   instance,
2) not delete any data in stopMonitor(),
3) add monitorCreateAll() that calls createInstance() for all
   monitors (and call that in main()), and
4) add monitorDestroyAll() that calls destroyInstance() for
   all monitors (and call that in main()).
2018-05-07 14:07:05 +03:00
Johan Wikman
02cd7b9275 MXS-1848 Add initMonitor() and finishMonitor() functions.
Not called and implementations are dummies.
2018-05-07 14:07:05 +03:00
Johan Wikman
ec8b9c773a MXS-1848 Use MXS_SPECIFIC_MONITOR type in monitor APIs
Now, all monitor functions but startMonitor takes a
MXS_SPECIFIC_MONITOR instead of MXS_MONITOR. That is, startMonitor
is now like a static factory member returning a new specific
monitor instance and the other functions are like member functions
of that instance.
2018-05-07 14:07:05 +03:00
Johan Wikman
d4008f7b28 MXS-1848 Introduce a specific monitor type
Instead of using void there's now a MXS_SPECIFIC_MONITOR struct
from which monitor specific types can be derived. This change
does not bring about other benefits than a bit of clarity but
this is the first step in clearing up the monitor API.
2018-05-07 14:07:05 +03:00
Esa Korhonen
10b2b4ac37 MXS-1703 Use monitor-specific array instead of linked list
Also starting cleanup of server specific monitor code.
2018-05-07 13:51:27 +03:00
Niclas Antti
02b6cd7004 MXS-173 Initial version of throttle filter 2018-04-30 08:51:50 +03:00
Markus Mäkelä
39ca403ffa
Deprecate mysql51_replication
Added back mysql51_replication and deprecated it. This allows old
configurations to be gracefully upgraded to 2.3 versions.
2018-04-27 12:34:37 +03:00
Esa Korhonen
5d010ff712 Cleanup SERVER struct
Removed one unused field. Rearranged others, clarified comments.
2018-04-27 10:48:56 +03:00
Esa Korhonen
de1e299f3f MXS-1745 Save all rows from SHOW ALL SLAVES STATUS
The master down verification through slaves won't work with this commit. It needs to be
redesigned to handle multiple slave connections or removed. Also, only the first row of
slave status data is used by the monitor, so multiple slave connections are still
incorrectly handled.
2018-04-27 10:48:45 +03:00
Esa Korhonen
7c933df56f MXS-1703 Remove support for MariaDB/MySQL versions less than 5.5
5.1 to 5.3 are officially not supported anymore, so support can be removed from
the monitor. This allows removing the config parameter "mysql51_replication".
2018-04-26 10:47:57 +03:00
Esa Korhonen
8e3bec5d09 MXS-1703 Rename fields in SlaveStatus
Althought the fields are still public, having the 'm_' is clearer.
2018-04-26 10:47:57 +03:00
Esa Korhonen
2a38902aa6 MXS-1639 Discard results when executing sql text files
This removes the limitation of not returning resultsets.
2018-04-24 13:21:44 +03:00