676 Commits

Author SHA1 Message Date
Esa Korhonen
5324a1bdaa MXS-1845 Assign server roles
Assign server roles (master, slave, relay master, slave of external master)
for a graph with possibly multiple paths to a slave server.
2018-06-13 17:38:53 +03:00
Esa Korhonen
3f82c25c62 MXS-1845 New algorithm for finding the master server
Not yet used, as more is needed to replace the old code. The
algorithm is based on counting the total number of slave nodes
a server has, possibly in multiple layers and/or cycles.
2018-06-13 17:38:33 +03:00
Markus Mäkelä
c798a4ae36
Remove use of HASHTABLE in galeramon
Replaced the HASHTABLE in galeramon with an std::unordered_map. This
simplifies the code by a great amount and makes it more readable. Removed
the extraneous functions that mostly logged debug information and
simplified the logic by removing redundant checks.
2018-06-11 10:22:23 +03:00
Markus Mäkelä
9263a06b15
Fix galera master selection
The master selection still used the current status instead of the pending
status. This caused the master selection to lag behind by one monitor
loop.
2018-06-11 10:22:23 +03:00
Markus Mäkelä
dd49d4faea
Check pending Synced status in Galeramon
The pending status must be used, not the current.
2018-06-08 14:41:11 +03:00
Markus Mäkelä
9f5358eac0
Remove server_get_parameter_nolock
The function is no longer needed as there is no recursive access to the
server.
2018-06-08 14:41:11 +03:00
Johan Wikman
8afa8c2c5a MXS-1775 Add MonitorInstanceSimple class
MonitorInstanceSimple is intended for simple monitors that
probe servers in a straightforward fashion. More complex monitors
can be derived directly from MonitorInstance.
2018-06-07 15:13:26 +03:00
Esa Korhonen
2481de260f Move monitor-dependent code in MariaDBServer to MariaDBMonitor
Removes Monitor-dependency from the MariaDBServer-class.
2018-06-06 22:28:38 +03:00
Johan Wikman
b2a190c2b8 MXS-1775 Add switchover_on_low_disk_space parameter 2018-06-06 15:25:57 +03:00
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
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