662 Commits

Author SHA1 Message Date
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
17c9ac95bd MXS-1845 Add unit test for the cycle find algorithm (Tarjan SCC)
Only a few test cases for now.
2018-06-05 16:33:51 +03:00
Esa Korhonen
9a0445cd4e MXS-1845 Save cycle members
The saved data may be useful later on. Also includes some cleanup.
2018-06-05 16:25:04 +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
ebcb807438 MXS-1775 Add default implementations 2018-06-01 13:48:15 +03:00
Johan Wikman
9b7e37e112 MXS-1775 Change MonitorInstance::configure() prototype
Now return boolean, to allow derived class to signal a failure
to configure.
2018-06-01 13:48:15 +03:00
Johan Wikman
0783af88ed MXS-1775 Make general cleanup
Document and rearrrange so that things look nice and tidy.
2018-06-01 13:48:15 +03:00
Johan Wikman
76cfe7291d MXS-1775 Move module entry point to the end of the file
Now the same way in all monitors.
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
Johan Wikman
0833db8a48 MXS-1775 Flush pending status to servers using common code 2018-06-01 13:48:15 +03:00
Johan Wikman
15b1c270a3 MXS-1775 Check connection in MonitorInstance::tick()
Since the connection checking is done in an identical fashion in
all monitors, it can be moved to the base-class.
2018-06-01 13:48:15 +03:00
Johan Wikman
a8205824f8 MXS-1775 Update statuses the usual way in MMMon
As all other monitors MMMon now only manipulates the pending_status
of the monitor object during analysis and only in the end touches
the server status.
2018-06-01 13:48:15 +03:00
Johan Wikman
4a5ed6ce7f MXS-1775 Fix GaleraMonitor to update pending_status 2018-06-01 13:48:15 +03:00
Johan Wikman
c0ace6a694 MXS-1775 Rename server_clear_set_status
Renamed to server_clear_set_status_nolock, like all other non-locking
functions are called. Rename arguments to be self-explanatory.
2018-06-01 13:48:15 +03:00
Johan Wikman
f50ebfce2a MXS-1775 Set/clear initial bits similarly in all monitors 2018-06-01 13:48:15 +03:00
Johan Wikman
8fed6752bd MXS-1775 Fix NDPCMonitor to update pending_status
Instead of continuously updating the status of the server object,
the monitor should update the pending_status of the monitor object
and then only at the end update the status of the server object.
2018-06-01 13:48:15 +03:00
Johan Wikman
ced063b1a0 MXS-1775 Fix GRMon to update pending_status
Instead of continuously updating the status of the server object,
the monitor should update the pending_status of the monitor object
and then only at the end update the status of the server object.
2018-06-01 13:48:15 +03:00
Johan Wikman
4b01656bef MXS-1775 Fix AuroraMonitor to update pending_status
Instead of continuously updating the status of the server object,
the monitor should update the pending_status of the monitor object
and then only at the end update the status of the server object.
2018-06-01 13:48:15 +03:00
Johan Wikman
8d1b8a1774 MXS-1775 Handle connection error the same way
All monitors (but for MariaDBMon) now handle connection errors in
the same manner.

An exception is MMMon that modifies both the server status and the
monitor status. However, in fact, all other monitors do it the wrong
way and update the server status directly instead of only the monitor
status that then at the end of the loop should be copied to the server
status.
2018-06-01 13:48:15 +03:00
Johan Wikman
5196371762 MXS-1775 Use same arrangement in update_server_status
All monitors (but possible for MariaDBMon) now handle the
connecting to the server in the same way, that is, if the
connecting fails, then the status is updated and we return.
2018-06-01 13:48:15 +03:00
Johan Wikman
df4e19eb27 MXS-1775 Provide default implementation for MonitorInstance::tick 2018-06-01 13:48:15 +03:00
Johan Wikman
68505a0bcb MXS-1775 Consistently name the argument to update_server_status() 2018-06-01 13:48:15 +03:00
Johan Wikman
cb1da5538c MXS-1775 Monitoring function named consistently
The main monitoring function now has the same name in all
monitors (except MariaDBMonitor) and is a member function.
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
Markus Mäkelä
5f167abafd
Add missing priority usage information to galeramon
The monitor did not print the current value of this parameter and knowing
it is helpful.
2018-05-28 10:34:06 +03:00
Esa Korhonen
f8940d4a2a Use 64bits for server status flags
Monitor journal still uses 32bits.
2018-05-23 16:19:08 +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
043232990c MXS-1859 Correct merge bug
Version comparison was wrong.
2018-05-21 15:58:12 +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
f3973b331f Fix rebase error. 2018-05-18 16:00:05 +03:00
Johan Wikman
650a739c92 MXS-1775 Move monitor loop to MonitorInstance 2018-05-18 16:00:05 +03:00
Johan Wikman
db30ea96f2 MXS-1775 m_master is now a member variable of MonitorInstance 2018-05-18 16:00:05 +03:00
Johan Wikman
5aa30e8613 MXS-1775 AurorMon now hangs up as the other monitors do 2018-05-18 16:00:05 +03:00
Johan Wikman
6eef6f52db MXS-1775 Wait the same way in all monitors 2018-05-18 16:00:05 +03:00
Johan Wikman
2396b555f8 MXS-1775 Monitor loop and monitoring separated
In preparation for moving the monitor loop to MonitorInstance.
2018-05-18 16:00:05 +03:00
Johan Wikman
6fff5a4f23 MXS-1775 Preparatory work for moving main loop to MonitorInstance 2018-05-18 16:00:05 +03:00
Johan Wikman
6db4ce54a9 MXS-1775 MonitorInstance now calls mysql_thread_[init|finish]() 2018-05-18 16:00:05 +03:00
Johan Wikman
15e3a2887c MXS-1775 Move status management to MonitorInstance 2018-05-18 16:00:05 +03:00