12810 Commits

Author SHA1 Message Date
Esa Korhonen
83fc3b1bc2 Merge branch '2.3' into develop 2019-03-04 17:43:53 +02:00
Esa Korhonen
4fd4b726a1 MXS-2325 Only enable events that were enabled on the master
The monitor now continuously updates a list of enabled server events. When
promoting a new master in failover/switchover, only events that were enabled
on the previous master are enabled on the new. This avoids enabling events
that may have been disabled on the master yet stayed in the SLAVESIDE_DISABLED-
state on the slave.

In the case of reset-replication command, events on the new master are only
enabled if the monitor had a master when the command was launched. Otherwise
all events remain disabled.
2019-03-04 16:00:07 +02:00
Esa Korhonen
c2459c420d MXS-2304 Rename fields of CONFIG_CONTEXT
Added m_-prefix.
2019-03-04 12:27:36 +02:00
Esa Korhonen
900cbb4cff MXS-2304 Move last config_get_x() functions inside class 2019-03-04 12:27:36 +02:00
Johan Wikman
019c8fc2e1 MXS-2333 Correct typo in Clustrix monitor tutorial 2019-03-04 10:43:39 +02:00
Markus Mäkelä
6c05fa7d54
MXS-2302: Use unique_ptr for hint storage
This removes the need to explicitly free them.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
d52f685ee2
MXS-2302: Rename hintfilter objects
Renamed the objects to camelcase variants.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
e5299e1eab
MXS-2302: Move hint parser into its own class
Keeping the parser state internal to a subclass makes the code more
readable and allows the removal of most parameters. It also removes the
need to return iterator ranges from the tokenization function thus making
the Token class obsolete.

Unit testing benefits from this as well as it more closely resembles usage
in the wild as more of the code can be run without a live system.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
3fef15e892
MXS-2302: Remove templates from parsing code
The templates were only used to make testing easier and upon review the
gain in testing convenience wasn't large enough to warrant its use.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
684ddfd12d
MXS-2302: Use filter template in hintfilter 2019-03-04 08:48:32 +02:00
Markus Mäkelä
1d49e45036
MXS-2302: Do hint processing in a member function
Also fixed a unit test failure.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
f106864659
MXS-2302: Use STL containers for hint storage
The named hints and the hint stack are now stored in STL containers.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
a6ab05b673
Fix format-overflow warnings in tests
The tests previously ignored these warnings but the change in compiler
flags caused them to fail.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
2045ac656b
MXS-2302: Remove unused hintfilter code
Also moved the token types into the correct file.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
ec234124b1
MXS-2302: Remove unused parsing code
Removed all code that is no longer used. The hint stack mechanism is still
in use but can, and should, be replaced with std::vector.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
c5a8b693c3
MXS-2302: Take new hint parsing code into use 2019-03-04 08:48:32 +02:00
Markus Mäkelä
ca9224bf88
MXS-2302: Rewrite hint tokenization and parsing
The tokenization is somewhat crude but given the small amount of token
types it is acceptably efficient while still maintaining readability. The
parsing is quite simple to implement as a sort of a recursive descent
parser and is a lot more readable that the old state machine
implementation.

Extended the unit test to check that all supported hint types are parsed
correctly. The stack mechanism isn't fully covered by the unit test and it
needs to be added once the stack mechanism uses STL containers.
2019-03-04 08:48:32 +02:00
Markus Mäkelä
897fee715d
MXS-2302: Use const char* in hintfilter functions 2019-03-04 08:48:32 +02:00
Markus Mäkelä
11be8ed0f0
MXS-2302: Add comment extraction code
The code extracts comments from a query. All three comment types are
supported and the double dash comments properly handle invalid input
(fixes MXS-2289).

The code uses iterators to access to the query and returns a list of
iterator pairs as start and end markers to comments. This makes testing
easier as the input and output can be passed as an std::string.
2019-03-04 08:48:32 +02:00
Timofey Turenko
8d6932abb2 fix compiler warnings in tests 2019-02-27 23:57:13 +02:00
Esa Korhonen
41a72bcc30 Fix config parameter related tests
The tests gave null arguments when a valid object was expected.
2019-02-25 17:10:00 +02:00
Esa Korhonen
2a63fb0776 MXS-2304 Store config parameter container as value in monitor and service 2019-02-22 16:53:17 +02:00
Esa Korhonen
3fa4a85a1e MXS-2304 Use values instead of pointers in CONFIG_CONTEXT
Simplifies ctor/dtor.
2019-02-22 16:39:45 +02:00
Esa Korhonen
ab7c19e1a4 MXS-2294 Update PAM authenticator documentation
Updated with new functionality. Also explains the account mapping more.
2019-02-22 15:31:40 +02:00
Esa Korhonen
5828c93112 MXS-2304 Convert static config parameter methods to non-static
Parameter handling changed in several places.
2019-02-22 15:17:55 +02:00
Esa Korhonen
b64e9b3ee0 MSX-2304 Store configuration parameters in a map
Also adds begin() and end() functions for loops.
2019-02-22 15:04:14 +02:00
Johan Wikman
a51f156372 Merge branch '2.3' into develop 2019-02-22 12:22:11 +02:00
Johan Wikman
675971bd3c MXS-2345 Query classifier collects db of USE stmt
qc_get_database_names() will now return the database used
in a USE statement.
2019-02-22 11:22:32 +02:00
Esa Korhonen
37db656cae Use correct service name and router module name
Both the base class and derived class had the fields, but the derived fields
were left blank.
2019-02-20 10:50:22 +02:00
Esa Korhonen
afe41c38ed Merge branch '2.3' into develop 2019-02-20 10:33:14 +02:00
Markus Mäkelä
c1d96d79f0
Document server port default value
The value has a default in 2.3.
2019-02-19 18:48:00 +02:00
Esa Korhonen
9fbaafea91 MXS-2304 Remove additional module parameter classes
Equivalent functionality is now in the basic config parameter class.
2019-02-19 13:52:44 +02:00
Esa Korhonen
48a6ab503e MXS-2292 PAM authenticator detects anonymous users with defined hosts
This allows anonymous user mapping from well-defined hosts.
2019-02-19 10:40:23 +02:00
Johan Wikman
bd3d5bb010 MXS-2329 Use durations in throttle filter 2019-02-19 10:11:57 +02:00
Johan Wikman
f3acf77a9f MXS-2329 Use durations in ccrfilter
The time window of the ccrfilter is now specified as a duration.
Internally, the time window is still always handled as seconds.
2019-02-19 10:11:57 +02:00
Johan Wikman
daf5c6b29c MXS-2332 When server is drained, report it as such
When the SERVER_BEING_DRAINED bit is on, if the number of connections
to the server is 0, the state is reported as "Drained", otherwise as
"Being Drained".
2019-02-19 10:06:37 +02:00
Esa Korhonen
f1dcc4ac98 MXS-2304 Remove config_get_value()
Replaced with other functions.
2019-02-18 11:34:15 +02:00
Esa Korhonen
f91a8813ea Reject "passwd" in monitor and service configs
Was deprecated in 2.3.
2019-02-18 11:34:15 +02:00
Esa Korhonen
35460923b1 Replace "passwd" with "password" in system test configs 2019-02-15 11:27:07 +02:00
Esa Korhonen
90e5b80b71 MXS-2050 Use global counter to detect log rotation request
Modules need to check the number regularly to detect a new log rotation.
2019-02-15 11:08:14 +02:00
Esa Korhonen
98a081f65b MXS-2050 Separate session log and shared log handling
Shared log file is accessed under a lock.
2019-02-15 11:08:14 +02:00
Esa Korhonen
25a53a649a MXS-2304 Remove config_get_param()
Replaced with other functions. Also removed password deprecation check.
2019-02-15 10:48:19 +02:00
Johan Wikman
1fd4ad64f6 MXS-2333 Add Clustrix monitor tutorial 2019-02-15 09:30:06 +02:00
Johan Wikman
21d9ec34cf MXS-2330 Use simpler queries
Since the current node id can be obtained using the function gtmnid()
the queries for finding out whether a node is in the quorum and whether
it is softfailed can be made simpler.
2019-02-15 08:09:03 +02:00
Johan Wikman
5c34550b40 MXS-2330 Do not use softfailed node as hub
When a softfailed node is finally revoked, it will appear as the
single node in a functioning Clustrix cluster. To ensure that the
Clustrix monitor will not stick to that node, if the node that is
used as hub is softfailed, it is immediately replaced with another
node.
2019-02-15 08:09:03 +02:00
Esa Korhonen
35e17d9878 Disable server config serialization test
The config parameter ordering depends on which end of the linked list the
parameters are added. The test should be re-enabled once parameter handling
has been refactored.
2019-02-14 15:39:37 +02:00
Johan Wikman
1fed465fdb MXS-2246 Remove duplicate info in SERVICE and Service
Both of them contained fields for the service and router names.
Now the names are in SERVICE and they must be accessed via member
function.
2019-02-14 15:24:10 +02:00
Johan Wikman
2528c5fa4d MXS-2253 Make Cache use the new duration config type
Internally the Cache used seconds, so some changes were needed.
2019-02-14 10:57:55 +02:00
Johan Wikman
c116452c25 MXS-2253 Add MXS_MODULE_PARAM_DURATION
Added a new module parameter type to be used for parameters
that specify a duration. With the suffixes 'h', 'm', 's' and
'ms' the duration can be specified in hours, minutes, seconds
or milliseconds, respectively.

Irrespective of how the duration is specified, it is always
returned as milliseconds.

For backward compatibility, when a duration value is read it must
be specifed how a value *not* defined using a suffix should be
interpreted; as seconds or milliseconds.

  value = param->get_duration(name, mxs::config::INTERPRET_AS_SECONDS);
2019-02-14 10:57:55 +02:00
Johan Wikman
a0d715a39f MXS-2253 Update general documentation regarding durations 2019-02-14 10:57:55 +02:00