Commit Graph

3902 Commits

Author SHA1 Message Date
156abe81ee Add type and module to default parameters
When default parameters are loaded, the type and module name are
added. This helps object serialization and allows all the code to expect
that all the parameters needed to create an object are always present.
2019-03-26 15:53:20 +02:00
b180c346d9 Make filter parameters a part of the definition
The filter parameters are now a part of the filter definition.
2019-03-26 13:44:04 +02:00
0915487329 Pass std::string to add/remove task
By passing strings instead of const char pointers to the task control
functions, we can safely make copies of them knowing that the contents
won't disappear.
2019-03-26 13:44:04 +02:00
f0756cd708 Queue addition of housekeeper tasks
This fixes the hang on startup when binlogrouter calls hktask_add.
2019-03-25 19:21:12 +02:00
1e4c5f5d2f Remove housekeeper.cc
It is no longer used.
2019-03-25 19:21:12 +02:00
c70dc23211 Fix processing of path parameters
Instead of the first character of the string being compared to the value
the whole string was compared.
2019-03-25 12:37:11 +02:00
4880edd373 Fix removal of servers from monitors
The last server wasn't removed as the set of relationships was empty. In
addition to this, changes to relationships via the relations endpoint
wasn't reflected by the monitor parameters.
2019-03-25 12:37:11 +02:00
9bb5e12413 Fix monitor creation and alteration
If a monitor was created at runtime, it was missing some parameters that
were assumed to be always present. In addition to that, the parameters
weren't validated against the list of common and module parameters.

Since the monitors always reconstruct the server list, the new servers can
be stored as a parameter. To make this possible, the
server_relationship_to_parameter helper function is needed.

This commit fixes the MaxCtrl test suite failures but does not fix the
failures in the REST API test suite.
2019-03-25 12:37:11 +02:00
75c6ef2dc8 Fix mxs_json_error usage
The function takes printf style arguments which means the format string
must be a string constant.
2019-03-22 12:52:56 +02:00
fadbdc7514 Merge branch '2.2' into 2.3 2019-03-22 12:11:24 +02:00
40df519be4 Never reactivate monitors
Reactivating monitors shouldn't be done as it's simpler to actually
destroy and create a new one. The performance of reactivation is
insignificant compared to the possible inconsistency problems it allows.
2019-03-21 18:19:10 +02:00
203bba0e1d Add support for multiple runtime error messages
Storing all the runtime errors makes it possible to return all of them
them via the REST API. MaxAdmin will still only show the latest error but
MaxCtrl will now show all errors if more than one error occurs.
2019-03-21 18:19:10 +02:00
494a8a660a Improve RoutingWorker utilities
Added an overload to execute_concurrently that takes an std::function as a
parameter and added a const version of operator* for rworker_local. Also
removed the std::move of the return value in rworker_local::values as it
can prevent RVO from taking place.
2019-03-21 18:19:09 +02:00
0130bc16e2 Fix monitor alteration
Alterations to monitors are now done with all changes present in the first
call to configure. This fixes the case where two parameters depended on
each other and one would get configured before the other.
2019-03-21 18:19:09 +02:00
60917238c3 Format config.cc and config_runtime.cc 2019-03-21 18:19:09 +02:00
be13cbc751 Fix parameter declaration formatting
Uncrustify always forced insertion of tabs which led to mangled formatting
of the parameters. Placing each part on a separate line seems to work
better and produce a more readable output.
2019-03-21 18:19:09 +02:00
c2fc80f122 Fix monitor creation
When the monitor was created, no parameters were passed to it.
2019-03-21 18:19:09 +02:00
3448a36b68 Fix runtime config error generation
The error string was passed as the format string.
2019-03-21 17:48:47 +02:00
2ba7e63e7e Merge branch '2.3' into develop 2019-03-21 09:26:06 +02:00
3ac1b40b63 MXS-2271 Refactor disk space checking
The functions are now in MonitorServer. Disk space can only be checked
during specific ticks. If a server misses a tick (e.g. is down) it will
be checked after disk_space_check_interval has passed.
2019-03-20 10:40:45 +02:00
cc3891a43c Fix test_modulecmd
The test created a mariadbmonitor without a valid configuration. The
test worked before because only the base monitor configuration was checked.
2019-03-19 15:04:42 +02:00
6b14479b6c MXS-2271 Rename MXS_MONITORED_SERVER to MonitorServer 2019-03-19 13:32:38 +02:00
c393d633fe MXS-2394 Accept substitute_variables
'substitute_variables' was not listed amongst the symbols that
are pre-parsed, which meant that it was always rejected.
2019-03-19 09:35:18 +02:00
6042a53cb3 Replace raw GWBUF pointers with mxs::Buffer
Now that the query queue is stored in an actual container, it is only
logical to use mxs::Buffer instead of GWBUF as the stored type.
2019-03-18 13:18:52 +02:00
3eef2648e1 MXS-2313: Expose only two rank values
The rank can now only be used to define two groups of servers: primary and
secondary servers. This limits the exposure and reduces the number of
possibilities that can arise from the use of this parameter thus making it
more predictable.
2019-03-18 13:12:59 +02:00
6f8bfd7d11 MXS-2313: Add enum to value conversion function
The helper function makes it easier to convert enum values at runtime to
their integer representation. Also changed the configuration processing
code to use the new function.
2019-03-18 13:12:59 +02:00
9b6b5270f1 MXS-2313: Use 64-bit integers to store rank
Although the default value is the maximum value of a signed 32-bit
integer, the value is stored as a 64-bit integer. The integer type
conversion functions return 64-bit values so storing it as one makes
sense.

Currently values higher than the default are allowed but the accepted
range of input should be restricted in the future.
2019-03-18 13:12:58 +02:00
0693514047 MXS-2313: Add server ranks
The servers now accept a rank parameter that tells which servers to
prioritize.
2019-03-18 13:10:23 +02:00
17245c4ce3 Fix false debug assertion
Given the following query:

PREPARE ps FROM 'PREPARE ps2 FROM \'SELECT 1\'';

The debug assertion is hit even though this is valid, albeit unsupported,
SQL. An optimization would be to ignore the query if the prepared
statement type is another prepared statement.
2019-03-18 12:17:48 +02:00
dd99cadfd2 Prevent unintended sharing of parsing info
When a single GWBUF was split into two with gwbuf_split, the new GWBUF
would point to the start of the shared data and the old one to the
end. Data-wise, this is fine but as the parsing info for queries is stored
in the shared buffer it causes problems when multiple packets get read in
one network payload. The end result would be that only the first query in
the lot would get parsed and the rest would get the same classification as
the first one.

To properly fix this without the need to deep clone the buffer would
require a reorganization of the buffer mechanism in MaxScale.

This commit alone doesn't fix the queued query routing problems in
readwritesplit. The commit from 2.2 which fixes the ordering problems with
queued queries is also required for a fully functional queued query
mechanism.
2019-03-18 12:17:48 +02:00
14b4fa632a MXS-2271 Move Monitor inside maxscale-namespace
Rearranged monitor.cc by namespace.
2019-03-15 12:57:35 +02:00
5e3f837b42 MXS-2271 Continue monitor header cleanup
No more free functions. Local functions moved to anonymous namespace.
2019-03-15 12:57:35 +02:00
667a9f1c6f Merge branch '2.3' into develop 2019-03-15 12:31:08 +02:00
29b8d12be3 Always ignore EPIPE errors
There's no reason to not ignore EPIPE errors in debug builds.
2019-03-14 20:08:13 +02:00
ac5ee1278c MXS-2271 Cleanup internal monitor header and its functions
Some functions still accessed the servers-array. Most functions are now
inside class. Removed unused defines.
2019-03-12 15:32:56 +02:00
e7abc53b70 MXS-2304 Clean up configuration serialization
The parameters are now written in the order they appear in the module
parameter definitions. Also enabled a previously disabled part in
server unit test.
2019-03-12 12:51:23 +02:00
a8949b2560 MXS-2271 Move free monitor functions into classes
Functions are divided to MonitorManager, Monitor, or the monitored
server.
2019-03-12 10:29:55 +02:00
40f24aaaee MXS-2271 Remove m_monitor self pointer 2019-03-12 10:29:55 +02:00
a8c878fbca MXS-2271 Remove unused setters
Runtime configuration changes now go through configure().
2019-03-12 10:29:55 +02:00
1858fe9127 MXS-2271 Monitor modifications always go through Monitor::configure()
Previously, runtime monitor modifications could directly alter monitor fields,
which could leave the text-form parameters and reality out-of-sync. Also,
the configure-function was not called for the entire monitor-object, only the
module-implementation.

Now, all modifications go through the overridden configure-function, which calls the
base-class function. As most configuration changes are given in text-form, this
removes the need for specific setters. The only exceptions are the server add/remove
operations, which must modify the text-form serverlist.
2019-03-12 10:19:45 +02:00
703f65700a Use INT with retain_last_statements
The default value is negative so the type must be INT in order to support
reading of serialized configurations.
2019-03-11 21:49:33 +02:00
1c3a5bda83 Merge branch '2.3' into develop 2019-03-11 12:29:56 +02:00
7f27db02a8 Fix global retain_last_statements
The default value was wrong.
2019-03-08 14:45:18 +02:00
247e558ffa Fix tls-model exposure to other modules
The flag was propagated to other modules that depend on it.
2019-03-08 12:10:31 +02:00
5005facfb1 Always dump the full configuration
Always storing runtime configuration changes prevents problems when the
change causes another parameter to change. One example of this is
transaction_replay that implicitly enables other parameters.
2019-03-08 12:10:31 +02:00
7db87784ac Deliver hangups only to valid DCBs
If a DCB was closed and a hangup event was sent to it via
dcb_hangup_foreach shortly after it was closed, the DCB would still
receive it even if it was closed. To prevent this, events must only be
delivered to DCBs if they haven't been closed.
2019-03-08 12:10:30 +02:00
71a3cde441 MXS-2373: Fix filter serialization
The module of a filter was ignored as it wasn't in the list of expected
module parameters.
2019-03-08 12:10:30 +02:00
95317725ce Merge branch '2.3' into develop 2019-03-07 16:21:03 +02:00
267ec9cccc Fix filter serialization
Filters were serialized with commas as separators instead of pipes.
2019-03-07 16:02:49 +02:00
c2459c420d MXS-2304 Rename fields of CONFIG_CONTEXT
Added m_-prefix.
2019-03-04 12:27:36 +02:00