Commit Graph

3902 Commits

Author SHA1 Message Date
900cbb4cff MXS-2304 Move last config_get_x() functions inside class 2019-03-04 12:27:36 +02:00
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
897fee715d MXS-2302: Use const char* in hintfilter functions 2019-03-04 08:48:32 +02:00
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
2a63fb0776 MXS-2304 Store config parameter container as value in monitor and service 2019-02-22 16:53:17 +02:00
3fa4a85a1e MXS-2304 Use values instead of pointers in CONFIG_CONTEXT
Simplifies ctor/dtor.
2019-02-22 16:39:45 +02:00
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
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
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
afe41c38ed Merge branch '2.3' into develop 2019-02-20 10:33:14 +02:00
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
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
f1dcc4ac98 MXS-2304 Remove config_get_value()
Replaced with other functions.
2019-02-18 11:34:15 +02:00
f91a8813ea Reject "passwd" in monitor and service configs
Was deprecated in 2.3.
2019-02-18 11:34:15 +02:00
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
25a53a649a MXS-2304 Remove config_get_param()
Replaced with other functions. Also removed password deprecation check.
2019-02-15 10:48:19 +02:00
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
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
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
49c6244245 Update MaxCtrl and REST API dependencies 2019-02-13 13:54:56 +02:00
9a12ae53f2 Merge branch '2.3' into develop 2019-02-13 13:35:07 +02:00
775fc043c8 MXS-2326: Clone routing hints on gwbuf_clone
When a buffer is cloned the hints for that buffer should also be cloned.
2019-02-13 13:34:48 +02:00
7a99b5d253 MXS-2314 Define monitor state in terms of worker state
Worker::STOPPED    -> MONITOR_STATE_STOPPED
Worker::POLLING    -> MONITOR_STATE_RUNNING
Worker::PROCESSING -> MONITOR_STATE_RUNNING

By defining the monitor state from the worker state there is
no risk they will ever get out of sync. And there is one thing
less to maintain.
2019-02-11 13:03:18 +02:00
544e88a0b8 MXS-2314 Remove unnecessary monitor state 2019-02-11 13:03:18 +02:00
72d02d33c0 MXS-2314 Remove unnecessary worker states
The removed states were not used for anything useful.
2019-02-11 13:03:18 +02:00
6425d4ed0c MXS-2314 Ensure that connections are closed
As m_servers is a member of Monitor, it is better if the closing
of the MYSQL connections is done there, so that derived classes
do not need to remember doing that.
2019-02-11 13:03:18 +02:00
dffb933efa MXS-2314 Do not accept NULL when starting/stopping monitor 2019-02-11 13:03:18 +02:00
3646c118c9 MXS-2314 Move journal checking inside Monitor 2019-02-11 13:03:18 +02:00
cac1d76e48 MXS-2314 Monitor decides whether servers are added to services
When the servers of a service are defined by a monitor, then
at startup all servers of the monitor should be added to relevant
services. Likewise, when a server is added to or removed from a
monitor at runtime, those changes should affect services as well.

However, whether that should happen or not depends upon the monitor.
In the case of the Clustrix monitor this should not happen as it
adds and removes servers depending on the runtime state of the
Clustrix cluster.
2019-02-11 13:03:18 +02:00
ab93216064 MXS-2314 Server added to monitor should be added to service
If the servers of a service are defined by a monitor (the config
has 'cluster=SomeMonitor'), then the addition of a server to a
a monitor should lead to that server being added to the service.
2019-02-11 13:03:18 +02:00
0e3ec06c5b MXS-2314 Prevent removal of servers from clustered services
If the servers of a service are defined by a monitor, then it must
not be possible to dynamically add or remove servers from the
service.
2019-02-11 13:03:18 +02:00
b4eb87dfcc MXS-2314 Populate services with servers
The services whose servers are defined using a monitor, will
now be populated from the monitor.

Note, no consideration has yet been given to runtime changes.
2019-02-11 13:03:18 +02:00
f271c5cea1 MXS-2314 Add 'cluster' parameter to service
Using the cluster parameter, the servers of a service can be
defined using a monitor.

This change basically only introduces the parameter.
2019-02-11 13:03:18 +02:00
1073bc1832 Remove false assertion
The list can be empty
2019-02-11 12:40:43 +02:00
35ab911d5c MXS-2304 Use configuration class methods instead of separate implementations
Replaces parameter add/set/remove/free.
2019-02-07 13:51:16 +02:00
ed80680da9 MXS-2304 Add ctor/dtor and other functions to parameter class
The manipulation functions are currently static so that the container can be initialized
if required. This will be fixed later.

The new functions are taken into use in monitor management.
2019-02-07 13:51:16 +02:00
934be45b68 MXS-2304 Remove config_get_string() and config_get_value_string()
Some functions accessing internal pointers still remain.
2019-02-06 12:58:59 +02:00
4b2c0b3edd MXS-2304 Cleanup server_alloc()
Avoids using config_get_string().
2019-02-06 12:36:23 +02:00
78d9ef2910 MXS-2304 Remove remaining uses of config_get_string() from module code
The function returns a pointer to an internal string and should not be
used.
2019-02-06 12:36:23 +02:00
5ab7734e9d MXS-2304 Add contains() to test if a parameter exists
Replaces uses of config_get_param() in modules either with contains()
or get_string(). The config_get_param() is moved to internal headers,
as it allows seeing inside a config setting.
2019-02-06 12:36:23 +02:00
b8be905b08 Merge branch '2.3' into develop 2019-02-06 12:24:09 +02:00
cf4724d128 MXS-2265: Fix formatting of the zero timestamp
The UNIX timestamp 0 should be treated as a special value and must be
interpreted as 0-00-00 00:00:00 instead of 1970-01-01 00:00:00.
2019-02-06 12:11:06 +02:00
4132c9bbbc MXS-2304 Use get_c_str_copy instead of config_copy_string()
Also uses get_string() in core-code when appropriate.
2019-02-05 10:28:37 +02:00
3eb7d89c80 MXS-2304 Use get_service() and get_server() 2019-02-01 17:31:41 +02:00
882d360355 MXS-2304 Use get_size() instead of config_get_size() 2019-02-01 17:23:14 +02:00
b357717149 MXS-2304 Use get_bool() instead of config_get_bool() 2019-02-01 17:18:49 +02:00
7cb969b0d9 MXS-2271 Clean up server list parsing functions, use in monitor config
The functions now return the parsed array.
2019-02-01 14:59:51 +02:00
6038f1f386 Merge branch '2.3' into develop 2019-02-01 13:55:54 +02:00
08dd55a26a Use -ftls-model=initial-exec with maxscale-common
Resolving the relocations right at startup reduces the cost of using
thread-local variables.
2019-02-01 13:20:44 +02:00
f2d2202ea3 MXS-2304 Use get_enum() instead of config_get_enum() 2019-02-01 10:29:24 +02:00