Commit Graph

167 Commits

Author SHA1 Message Date
00d0ec5f8e Move wait_for_maxscale functionality inside MaxScale
By exposing a (currently undocumented) debug endpoint that lets one
monitor interval pass, we make the reuse of the monitor waiting
functionality a lot easier. With it, when MaxScale is started by the test
framework it knows that at least one monitor interval will have passed for
all monitors and that the system is ready to accept queries.
2018-11-09 09:13:27 +02:00
ecc7442358 Detect manual commands faster
Previous, MariaDBMonitor would wait until the next monitor interval before detecting
a new manual command. The commands are now checked every 100 ms.
2018-11-08 19:12:00 +02:00
fe3900be0e MXS-2102 Allow runtime change of disk_space_threshold for monitor
This is currently disallowed for the server parameter, as the value could be
read/written concurrently. The monitor parameter can be changed since the
monitor is stopped during write.
2018-11-06 11:44:50 +02:00
906d8cee5b Format all files
Formatted all files with uncrustify.
2018-10-31 09:46:02 +02:00
f518b38364 Initialize disk_space_checked
Was reading an uninitialized value.
2018-10-16 16:09:38 +03:00
75ea1b6ea1 Fix formatting of new(std::nothrow)
The code previously formatted everything as `new( std::nothrow)`.
2018-10-04 21:50:44 +03:00
8b9fdaa0cb Remove HTTP functionality
It wasn't used so it can be removed.
2018-10-03 08:41:45 +03:00
9278da1f54 MXS-2067: Remove spinlock.h
Removed the spinlock.h header and replaced with plain pthread types and
functions.
2018-09-28 12:18:24 +03:00
ab4f870927 MXS-2067: Replace most SPINLOCKs
Replaced SPINLOCK with std::mutex where possible, leaving out the more
complex cases. The big offenders remaining are the binlogrouter and the
gateway.cc OpenSSL locks.
2018-09-28 12:18:23 +03:00
71ffef5708 Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
2e069fa892 MXS-1632: Take mxb::atomic::add into use
The function now mostly replaces the use of atomic_add_ functions declared
in atomic.h.
2018-09-18 15:21:54 +03:00
d11c78ad80 Format all sources with Uncrustify
Formatted all sources and manually tuned some files to make the code look
neater.
2018-09-10 13:22:49 +03:00
c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00
a593d00c65 Simplify failed master detection
No longer depends on monitor events as the other operations do not
either. The active_event/new_event detection was removed, as these
only protect against a rare situation. A similar feature which
protects all the cluster modifications will be implemented later.
2018-08-29 17:04:05 +03:00
a6bef0a80d Add credentials for remove REST API calls
The base URL and credentials used for REST API calls can now be defined in
the [maxscale] section. This allows encrypted passwords to be used.
2018-08-23 15:46:46 +03:00
13c04324cf Add master extraction via REST API
The master server of a monitor can now be extracted with the
mon_get_external_master function. It uses the REST API to find a master
server in the set of servers monitored by a monitor.
2018-08-23 15:46:45 +03:00
5485f83e75 MXS-1929: Always store the module name parameter
Services, monitors and filters all use the parameters for object
serialization. This means that when the object is created, the module
parameter must be in the parameter list.
2018-08-22 16:43:17 +03:00
3f53eddbde MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message] 2018-08-22 11:34:59 +03:00
b1e405442f MXS-2020 Replace ss_debug with MXB_AT_DEBUG 2018-08-22 11:34:06 +03:00
e5c2b1a8c4 Create JSON serialization from object parameters
The services, monitors and filters now construct the JSON format
parameters from the configuration parameters. This reduces the need for
the amount of explicit operations and makes adding new parameters easier.
2018-08-20 13:56:59 +03:00
a9ff2a7056 MXS-1929: Serialize objects using parameters
The main "non-static" objects are now serialized using their
parameters. This makes it possible to use common code for most modules.
2018-08-20 13:56:59 +03:00
cf0aeed516 MXS-2014 Rename log_manager.h to log.h
There's nothing resembling a manager anymore.
2018-08-17 10:59:37 +03:00
57706e7758 Hide the MonitorInstance m_state field
The field had the same purpose as MXS_MONITOR->state. Now the field
is only used for checking if the MonitorInstance thread is running.
2018-08-17 09:47:32 +03:00
fe5df6d379 Remove duplicate monitor state definitions
The state is still stored in two different variables. Also, removed the
ALLOC and FREED states.
2018-08-17 09:47:32 +03:00
419aefb173 Update basic monitor parameters
All of the monitor parameters are now kept up to date when they are
altered. This simplifies the parameter list generation for the REST API.
2018-08-14 15:08:51 +03:00
4c8aee2b61 Fix monitor REST API output
Updates to common monitor parameters weren't displayed.
2018-08-14 14:57:34 +03:00
ddc422b102 MonitorInstance::diagnostics_json() should return an empty object
Some of the inheriting classes call the base class diagnostics_json
when constructing their own diagnostics data.
2018-08-13 11:30:21 +03:00
eab0a22518 Use parameters list when converting monitor parameters to json
The json conversion now processes the general monitor parameters similarly
to the module-specific settings.
2018-08-13 11:18:04 +03:00
b9ec3f5130 Monitor json diagnostics printing cleanup
The 'events' and 'script' config values were defined for every monitor.
Removed the extra definitions and moved the variables to MXS_MONITOR.

MariaDBMonitor was printing config values a second time, they are
already printed by the caller.

Moved the events enum definition to the internal header since it's no longer
required by modules.

Added a default config setting "all" to 'events' to clarify that it enables
all events.
2018-08-10 11:19:09 +03:00
a252b45f18 Don't use auto&& in non-template code
Use explicit types instead.
2018-08-06 21:20:29 +03:00
46ed043fb0 Display diagnostics for running monitors
If a monitor is not running, the diagnostics function will not be called.
2018-08-02 18:56:36 +03:00
d412b8d729 Move execute_worker_task into mxs::Worker
The function has use outside of the monitors as it makes execution of
worker tasks much more convenient. Currently, this change only moves the
code and takes it into use: there should be no functional changes.
2018-08-02 18:56:35 +03:00
ec420332ea MXS-1929: Take ResultSet into use
Replaced the previous RESULTSET with the new implementation. As the new
ResultSet doesn't have a JSON streaming capability, the MaxInfo JSON
interface has been removed. This should not be a big problem as the REST
API offers the same information in a more secure and structured way.
2018-07-31 22:50:08 +03:00
1e33ab69f2 Rename server_is_running() to server_is_usable()
The previous name was misleading. The new server_is_running() only
checks for the running bit so that a server is always either running
or down.
2018-07-31 14:53:56 +03:00
3be975ba5d Fix fixing of std::string object names
Comparing two fixed std::strings would have equal C strings but comparing
with operator== they would be different. This was a result of the string
modification done by fix_object_name.

Converted the internal header into a C++ header, added std::string
overload and fixed use of the function.
2018-07-31 09:41:15 +03:00
fbce38878b Turn server status macros to functions 2018-07-25 11:19:47 +03:00
b421e56d1c Move execute_worker_task to MonitorInstance
The function is rather general and may of use to other monitor modules.
2018-07-24 15:07:18 +03:00
c31e78754d Fix object name tokenization
Spaces must be considered a part of the object name in tokenization. This
ensures that the name normalization process generates correct names and
that tokens are split at correct places.
2018-07-17 11:52:23 +03:00
4a0ace2a72 Use module-style parameters with monitors
The common monitor parameters are now stored as module-style
parameters. This makes the error reporting as well as the type checks for
the parameters consistent with parameters declared by the modules.
2018-07-17 11:52:15 +03:00
7ded2c436f Fix monitor shutdown and restart
Monitor restart was not working.
2018-07-03 10:32:06 +03:00
1eddb29d91 MXS-1915 Move Monitors on top of mxs::Worker
Monitors are now workers, so the path for making all interaction
between MaxScale proper and the monitors message based is now
open.
2018-06-26 09:19:46 +03:00
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
026313fcc7 Clear status bits of server that are down
At the start of the monitor tick, the monitor pending status is set to the
value of the current server status. This allows the informative and
history bits to survive even if a server goes down.

To make sure that no stale state bits are in effect when the post_tick
method is called, the pending status must be cleared of all status bits.
2018-06-18 14:25:05 +03:00
d0453bd3ed Measure monitor loop execution time when calculating sleep time 2018-06-11 13:30:36 +03:00
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
6d1863451a MXS-1775 Fix galera monitor
The statuses were flushed at the wrong place as far as the
Galera monitor was concerned.
2018-06-06 15:34:40 +03:00
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
f600b3a769 MXS-1775 Check disk space in MariaDBMonitor 2018-06-06 15:25:57 +03:00
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
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