Commit Graph

131 Commits

Author SHA1 Message Date
f3f802cabe MXS-2008 Move maxscale/atomic.h to maxbase/atomic.h 2018-08-15 08:44:39 +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
46dee98b25 MXS-1929: Report runtime module loading errors to users
If a module is not found, a proper error message is now given to the
user. Other system errors are also printed if errno is set. Dynamic
library errors aren't printed as they are apparently reset after a call to
`dlerror`, at least according to documentation.
2018-08-13 10:28:03 +03:00
6661680c4e MXS-1929: Add direct filter relationship updates
The filters of a service can now be directly updated via the relationships
endpoint.
2018-08-10 09:53:33 +03:00
290dcff48e Add runtime size type check
Took the size type validity check function into use in runtime
configuration. This fixes the problem with zero not being accepted as a
valid size for query_classifier_cache_size.
2018-08-10 09:50:54 +03:00
f14380243b Rename cppdefs.hh to ccdefs.hh
For obvious reasons; the c++ suffix is .cc and not .cpp
2018-08-10 07:50:18 +03:00
f560172665 MXS-1929: Fix creation of filters that have no parameters
If the filter does not declare defaults and no parameters are defined, the
list of parameters would be NULL. This was interpreted as an error and the
filter creation failed.
2018-08-09 12:56:48 +03:00
2539183be2 MXS-2000 Add query_classifier_cache_size to maxscale resource 2018-08-09 08:37:44 +03:00
0b3e9cce75 Fix rebase problems 2018-08-08 09:21:59 +03:00
326bb88f70 MXS-1992 Expose config.cc:runtime_error as config_runtime_error 2018-08-08 09:17:58 +03:00
1b521b16a9 MXS-1992 Move QC json "parsing" to query_classifier.cc 2018-08-08 09:17:15 +03:00
2188090742 MXS-1992 Expose type checking functions of config_runtime.cc
The functions

bool runtime_is_string_or_null(json_t* json, const char* path);
bool runtime_is_bool_or_null(json_t* json, const char* path);
bool runtime_is_count_or_null(json_t* json, const char* path);

can now be called from anywhere inside MaxScale.
2018-08-08 09:17:15 +03:00
185758ef06 MXS-1992 Allow changing the QC cache size 2018-08-08 09:17:15 +03:00
bb1efd1b34 Merge branch '2.2' into develop 2018-08-07 22:20:27 +03:00
446116a8bb MXS-1999: Fix removal of undefined relationships
If a relationship isn't defined, it should not be removed. Only if a
relationship is change to a null relationship, should it be removed.

Also fixed the maxctrl test suite to verify that both it and the REST API
tests pass.
2018-08-07 22:14:33 +03:00
4fd4d6bb01 MXS-1999: Fix null relationship handling
The data of the relationship should be set to null to delete the
relationship. Conceptually it is different from setting it to an empty
relationship but in practice both lead to the same end result.

Updated tests to use correct relationships and added test cases for
detection of invalid relationships.
2018-08-07 22:14:32 +03:00
03553783fb MXS-1929: Process filter relationships for services
The filter relationships of a service are now interpreted as an ordered
list of filters being used by the service. As the relationship data in the
JSON API specification is represented as an array, it does not prevent
multiple relationships from appearing. For MaxScale, this means that
interpreting the filter's order does not break it.
2018-08-06 21:20:29 +03:00
5d085f5cdf MXS-1929: Remove service parameter setters
Removed the explicit setters for the service parameters. Not all of them
were implemented and they were only used internally. Moved the parameter
validation and update processing inside the Service class to reduce the
load on the other parts of the core.
2018-08-06 21:20:29 +03:00
4d3dbb2040 MXS-1929: Take SFilterDef into use
The service now uses a std::vector<SFilterDef> to store the filters it
uses. Most internal parts deal with the SFilterDef but debugcmd.cc still
moves raw pointers around (needs to be changed).
2018-08-06 21:20:29 +03:00
a252b45f18 Don't use auto&& in non-template code
Use explicit types instead.
2018-08-06 21:20:29 +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
cca7757090 MXS-1929: Take internal Service struct into use
The internals now mostly refer to the Service struct instead of the public
SERVICE struct.
2018-07-31 09:41:13 +03:00
829fdcff83 MXS-1929: Make filters fully opaque
The filter implementation is now fully hidden. Also converted it to a C++
struct allocated with new and stored the filters in a global list instead
of embedding the list in the object itself.
2018-07-31 09:41:13 +03:00
e39242d6e5 MXS-1929: Add filter deletion entry points
Added the code required to delete a filter via the REST API. The actual
deleting of the filters is still to be implemented.
2018-07-31 09:41:11 +03:00
22cc155e55 MXS-1929: Process relationships when creating services
The relationships of a service are handled by the service alteration
code. Currently, only server relationships are handled by the code in
question and filter relationships are ignored.
2018-07-31 09:41:10 +03:00
fb3101f7c4 MXS-1929: Improve JSON type error messages
If an invalid value or type is given to the REST API, having the expected
type as well as the given type make problem resolution easier.

Also added a value check into MaxCtrl for listener ports.
2018-07-31 09:41:10 +03:00
0c63471715 MXS-1929: Use correct object type when loading defaults
The service creation attempted to load defaults for a filter module when
the module in question was a router.
2018-07-31 09:41:09 +03:00
037cedf70e MXS-1929: Allow service creation at runtime
Services can now be created at runtime. The command to create services is
exposed in the REST API.
2018-07-31 09:41:07 +03:00
5a40064826 MXS-1929: Make services destroyable
Services can now be destroyed if they have no active listeners and they
are not linked to servers. When these conditions are met, the service will
be destroyed when the last session for the service is closed.

The closing of a service will close all listeners that were once assigned
to the service. This allows closing of the ports at runtime which
previously was done only on shutdown.

Exposed the command through the REST API but not through MaxAdmin as it is
deprecated.
2018-07-31 09:41:07 +03:00
18c1ec2678 MXS-1929: Make listeners inactive when destroyed
By using service_remove_listener the listener is marked as inactive when
it is destroyed.
2018-07-31 09:41:06 +03:00
b93eaf6fb2 MXS-1929: Validate multiple JSON relationships
The runtime configuration JSON validation now allows multiple
relationships to be verified at one time. This makes it easier to validate
all objects using the same framework.
2018-07-31 09:41:06 +03:00
2c1f79c5d1 MXS-1929: Add runtime creation of filters
Filters can now be created at runtime. This is not yet a usable feature
since the filters can't be added to services at runtime.
2018-07-31 09:41:05 +03:00
d9fde54b95 Use mxs::SpinLock in config_runtime.cc
The C++ version with the lock guard is easier to manage when there are
multiple return points from a function. It also makes sure that the lock
is freed after it's used.
2018-07-17 11:52:37 +03:00
df94ef990c Use module-type parameters for servers
The server base objects now use the module-type parameters for generic
configuration.
2018-07-17 11:52:20 +03:00
d28b1c9d1d Validate SSL parameters via the module-type parameters
The configuration system that modules use allows the SSL parameter
validation to be simplified. It should also provide more consistent error
messages for similar types of errors.

The SSL_LISTENER initialization is now done in one step. There was no good
reason to do it in two separate steps for listeners but in one step for
servers.

The `ssl` parameter now also accepts boolean values. As the parameter
behaves like a boolean and looks like a boolean, it ought to be a
boolean. It still accepts the custom `required` and `disabled` values
simply for backwards compatibility.

Also added the missing freeing functions for the SSL_LISTENER type. This
prevents failed SSL_LISTENER creations from leaking memory.
2018-07-17 11:52:20 +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
f807c21242 Treat service parameters as module parameters
The same mechanism that is used for modules can be used for the
configuration of the core objects. This removes the need for the redundant
code that validates various values that is already present in the code
that modules use.
2018-07-17 11:52:14 +03:00
313bb0a5b4 Fix alteration of new router parameters
If a router parameter has no default value, the previous value would be
returned as an empty string. A debug assertion would be triggered when a
parameter of this type was altered.

When a new router parameter is encountered and the alteration fails, the
modified value in the service need to be removed. Previously, the new
value would have been stored in the service with an empty value which
would have caused problems.
2018-07-11 14:08:53 +03:00
6d663c79ac Extend router alteration test
Extended the test to cover modifications to readconnroute as well as do
checks on detection of invalid parameters.

Also allowed modifications to router_options at runtime.
2018-07-11 14:08:52 +03:00
28ceb1bad8 Take router reconfiguration into use
The router parameters can now be reconfigured at runtime if the router
supports it. Both MaxAdmin and the REST API support it.
2018-07-11 14:08:46 +03:00
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
96ed651466 Merge branch '2.2' into develop 2018-06-11 11:28:36 +03:00
1a24f0a956 Merge branch '2.1' into 2.2 2018-06-11 10:36:57 +03:00
0d73530ff3 Merge branch '2.2' into develop 2018-06-08 11:30:55 +03:00
a7dd2127d6 Merge branch '2.1' into 2.2 2018-06-08 11:21:35 +03:00
12035289f4 Remove server authenticator options
Was unused. A warning is printed if the parameter is defined. Any value is ignored.
2018-05-08 14:18:00 +03:00
851cefefc6 MXS-1848 monitor_[alloc|free]() -> monitor_[create|destroy]
As these will call the createInstance and destroyInstance functions
of the monitor, they are more appropriately named like this.
2018-05-07 14:08:36 +03:00
510eb7ec7c MXS-1848 Change monitorCamelCase to monitor_snake_case 2018-05-07 14:08:36 +03:00
83f3d6d71d MXS-1848 Rename monitorDestroy to monitor_deactivate
MonitorDestroy() (renamed to monitor_destroy()) will be used for
actually destroying the monitor instance, that is, execute
destroyInstance() on the loaded module instance and freeing the
the monitor instance.

TODO: monitor_deactivate() could do all the stuff which is currently
      done to the monitor in config_runtime(), instead of just
      turning off the flag.
2018-05-07 14:07:05 +03:00
658329b648 Merge branch '2.2' into develop 2018-05-03 10:00:44 +03:00