12969 Commits

Author SHA1 Message Date
Markus Mäkelä
03121c63d4
Add monitor reconfiguration helper
The MonitorManager function reconfigured a monitor and rolls back to the
old configuration if the new one doesn't work.
2019-03-26 17:30:38 +02:00
Markus Mäkelä
22004702bc
Don't use CONFIG_CONTEXT in config_runtime.cc
The only thing that's needed is MXS_CONFIG_PARAMETER.
2019-03-26 15:53:20 +02:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
fd39291542
Don't indent extern "C" blocks 2019-03-26 13:44:04 +02:00
Markus Mäkelä
f8bc6b18fc
Only add tasks once in binlogrouter
Adding the same task twice isn't allowed. The API of the housekeeper tasks
might have to be changed in a way that makes it possible for the caller to
know whether a task has been added.
2019-03-26 13:44:04 +02:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
1e4c5f5d2f
Remove housekeeper.cc
It is no longer used.
2019-03-25 19:21:12 +02:00
Markus Mäkelä
2cbfe4fb8a
Stop maxscale if it won't be restarted
This makes sure no MaxScales are running when the test is started.
2019-03-25 19:21:12 +02:00
Johan Wikman
bf5f80b13b Fix ClustrixMonitor
The cluster check can only be made after the monitor has been
started. If done when monitor is configured it will at startup
be done when services are not yet available and hence they will
not be populated with the dynamically discovered servers.
2019-03-25 13:56:39 +02:00
Markus Mäkelä
382ddf3ea1
Update bug673 to expect new behavior
Since whitespace in object names is now disallowed, the test must be
adjusted accordingly.
2019-03-25 12:37:11 +02:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Esa Korhonen
2f634264dc Merge branch '2.3' into develop 2019-03-22 13:39:52 +02:00
Esa Korhonen
4c6306e363 Merge commit '5cdba97ec7ee7f1ef74249b952774adf1b111464' into develop 2019-03-22 13:25:58 +02:00
Markus Mäkelä
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
Esa Korhonen
fadbdc7514 Merge branch '2.2' into 2.3 2019-03-22 12:11:24 +02:00
Esa Korhonen
5cdba97ec7 Merge commit '216eb904c557509ea5a3216e68e274df957ab807' into 2.3 2019-03-22 10:48:31 +02:00
Markus Mäkelä
c57682291f
Add missing json_api.hh header
The json_api.hh was not renamed but removed.
2019-03-22 02:05:36 +02:00
Markus Mäkelä
114c172387
Fix examplefilter
It used the old configuration parameter code.
2019-03-21 18:39:40 +02:00
Markus Mäkelä
bf2d6673bc
Merge branch '2.3' into develop 2019-03-21 18:23:27 +02:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
74eeb64fba
Don't close connections to servers being drained
The connections to servers being drained should not be closed like they
should be for servers in maintenance mode. The change in functionality
between 2.3 and develop caused the connections to be discarded if the
server was in either maintenance or drain mode.
2019-03-21 18:19:10 +02:00
Markus Mäkelä
8ed192892a
Make worker-local data lookups faster
By using a std::vector to store the keys, the cost of key lookup goes down
in comparison with std::unordered_map. The downside is the increase in
memory use in certain situations but given the fact that the intended
purpose of worker-local data is to store global data, this is unlikely to
have observable negative side-effects. Depending on the implementations of
std::vector and std::unordered_map, the use of std::vector could even
result in a smaller memory footprint.
2019-03-21 18:19:10 +02:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
60917238c3
Format config.cc and config_runtime.cc 2019-03-21 18:19:09 +02:00
Markus Mäkelä
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
Markus Mäkelä
c2fc80f122
Fix monitor creation
When the monitor was created, no parameters were passed to it.
2019-03-21 18:19:09 +02:00
Markus Mäkelä
0f1bc60431
Fix masking and dwfwfilter compilation
The filters were broken by the merge.
2019-03-21 18:18:33 +02:00
Markus Mäkelä
9bc721afb6
Merge commit '11ee74bad327e7fb15e8388d20e7838b9e49cadf' into 2.3 2019-03-21 17:52:42 +02:00
Markus Mäkelä
3448a36b68
Fix runtime config error generation
The error string was passed as the format string.
2019-03-21 17:48:47 +02:00
Esa Korhonen
9236ace077 MXS-2355 If client is using the wrong authenticator, attempt a switch
Some SQL clients may default to a different authentication plugin than
"mysql_native_password". Since this is the only one supported by MySQL-
authenticator, the client is instructed to swap its plugin.
2019-03-21 17:07:09 +02:00
Esa Korhonen
216eb904c5 MXS-1991 Allow replication_user and replication_password be set runtime
Because runtime changes are performed one at a time, adding replication credentials
to a mariadbmon which didn't have any would cause an error to be printed, and
the monitor would not start.

This is now fixed by allowing replication_user without replication_password. This
is not an ideal solution as a configuration file with only replication_user would be
accepted. Also, when adding the credentials to a monitor, replication_user must be
given first to avoid the error.
2019-03-21 17:06:24 +02:00
Johan Wikman
559b786533 MXS-2398 Handle MariaDB specific comments
Same approach as with regular comments:
- /*M! STMT */ are always parsed.
- /*M!###### STMT */ are never parsed.
2019-03-21 14:57:24 +02:00
Markus Mäkelä
11ee74bad3
Free the readwritesplit query queue
If the queue isn't empty when the session closes, the queue would leak.
2019-03-21 11:22:40 +02:00
Esa Korhonen
2c4228db47 MXS-2400 Extend examplefilter
Added more comments. Also the filter now demonstrates how to
1) read configuration parameters
2) react to queries and replies
3) handle shared filter data
4) print diagnostics output
5) add log entries

As the filter is already built and moved to the library directory,
it is immediately usable. This should be helpful with assignments.
2019-03-21 11:02:16 +02:00
Johan Wikman
2ba7e63e7e Merge branch '2.3' into develop 2019-03-21 09:26:06 +02:00
Johan Wikman
65b4ac7c1b MXS-2389 Handle MariaDB comment correctly
A non version specific executable comment, such as "/*! SELECT 1; */"
is during classification handled as if it would not be a comment. That
is, the contained statement will *always* be parsed.

A version specific executable comment, such as "/*!99999 CREATE PROCEDURE
 bypass BEGIN */ SELECT ... " is during classification handled as it would
be a general comment. That is, the contained statement will *never* be
parsed.

In addition, in the latter case the parse result will never be better than
QC_QUERY_PARTIALLY_PARSED. The rationale is that since the comment is version
specific, we cannot know how the server will actually interpret the statement.

This will have an impact on the masking filter and the database firewall that
now will reject statements containing _version specific_ executable comments.
2019-03-20 16:17:50 +02:00
Johan Wikman
9b27d7f24b MXS-2396 Reject use of masked var in variable definition
E.g.

   set @a = (SELECT fld FROM table);

will be rejected if 'fld' is a field that should be masked.
2019-03-20 15:11:58 +02:00
Johan Wikman
eb0f3ebe81 MXS-2396 Cleanup conceptually 2019-03-20 15:11:58 +02:00
Johan Wikman
7bb3cc6535 MXS-2396 Make preparations for adding additional checks 2019-03-20 15:11:58 +02:00
Johan Wikman
76ac63096c MXS-2396 Add check_user_variables configuration parameter
The masking filter should check for things like

    set @ssn = (SELECT ssn FROM users WHERE id = 1);

so that

    select @ssn;

is not possible.
2019-03-20 15:11:58 +02:00
Esa Korhonen
09ae5d741c MXS-2384 Update servers concurrently in MariaDB-Monitor
All servers are now updated in their own threads simultaneously. This
should reduce the possibility of having significantly different gtid:s
shown for different servers.
2019-03-20 10:40:45 +02:00
Esa Korhonen
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
Markus Mäkelä
0b77c3f05f
MXS-2324: Prevent stack overflow with large results
If a result consists of only OK packets, they would be processed
recursively which most of the time leads to a stack overflow. This can be
prevented by consuming all OK packets in the result in one go.
2019-03-20 10:29:03 +02:00
Johan Wikman
a6f52b008f MXS-2390 Firewall should reject statements prepared from var
Currently no practical way for checking what the statement
actually does and thus blanket rejection is the only alternative.
2019-03-19 15:53:46 +02:00