Commit Graph

3420 Commits

Author SHA1 Message Date
4193c4d3db MXS-2002 Add additional versions of Worker::[call|execute]() 2018-08-13 08:30:05 +03:00
e9758ebaf1 MXS-2002 Rename Worker::post() to Worker::execute()
The main point is that tasks/functions are executed, not that
they are posted.
2018-08-13 08:30:05 +03:00
3013adb14f MXS-2002 Worker::execute() renamed to Worker::call()
In preparation for Worker::post() to be renamed to Worker:execute().
The concept of _posting_ will be reserved to mean the transfer of
something over the message queue to the worker for processing and
nothing else.
2018-08-13 08:30:05 +03:00
6335d3776c MXS-2002 Replace auto_ptr with unique_ptr
Given 'Derived : public Base', a unique_ptr<Derived> converts
implictly to a unique_ptr<Base>.
2018-08-13 08:30:05 +03:00
9cfd451a1d MXS-2002 Make Worker excecution mode explicit
This is the first step in some cleanup of the Worker interface.
The execution mode must now be explicitly specified, but that is
just a temporary step. Further down the road, _posting_ will
*always* mean via the message loop while _executing_ will optionally
and by default mean direct execution if the calling thread is that
of the worker.
2018-08-13 08:30:05 +03:00
b9ec3f5130 Monitor json diagnostics printing cleanup
The 'events' and 'script' config values were defined for every monitor.
Removed the extra definitions and moved the variables to MXS_MONITOR.

MariaDBMonitor was printing config values a second time, they are
already printed by the caller.

Moved the events enum definition to the internal header since it's no longer
required by modules.

Added a default config setting "all" to 'events' to clarify that it enables
all events.
2018-08-10 11:19:09 +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
8351bf8451 Add missing value initialization
The query classifier cache statistics returned an uninitialized pointer.
2018-08-10 09:53:31 +03:00
7c627144fb Fix basic parameters
The ssl parameters were defined as strings even thought they were actually
enums. The events parameter was also a string even though it was an enum.

Also added the missing "all" value to the events enum. This fixes the
regression of scripts not being launched on all events by default.

Moved the definition of the default version string where it should be and
removed the empty value check.
2018-08-10 09:50:56 +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
ac098c4a02 Check validity of size types
The get_suffixed_size function is now exposed in the internal config
header and it also checks for the validity of the size types.

Took the new function into use and added the appropriate error messages.
2018-08-10 09:44:44 +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
db09996bb8 MXS-1929: Prevent destruction of services with filters
If a service has filters, they must first be removed before the service
can be destroyed. This is not a functional requirement but it keeps the
behavior consistent so that the relationships of a service must be empty
before it is destroyed.
2018-08-09 12:56:52 +03:00
38219556b6 Fix crash on failure to listen on port
If a listener was created at runtime and at some point it fails (e.g. the
port is already taken), the listener would be removed from the service. In
2.2, the removal of the listeners simply marked the listener as
inactive. In 2.3, the functions were combined so that the listener is
marked as inactive and removed from the workers. The fact that the
listener had a NULL DCB at that point caused the crash.

The correct thing to do is to not remove the listener from the service and
to mark the listener as inactive in the close_port helper function. The
listener will be freed once the service is destroyed.
2018-08-09 12:56:50 +03:00
6e481a0f95 Fix REST API tests
The tests expected results that weren't correct.
2018-08-09 12:56:49 +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
c56ef3cc27 Stop processing configuration after the first failure
If the configuration processing encounters an error at the object
construction stage, it needs to stop immediately. If another object
depends on the object that failed, it would also fail but in a very
confusing manner. Mainly this manifests itself as a missing reference to
the object which would cause misleading errors to be logged.
2018-08-09 12:54:14 +03:00
6e79e34dd7 Do not destroy services when setting filters fails
If the setting of filters for a service fails at startup, it need not be
destroyed as it will be destroyed when MaxScale stops.
2018-08-09 12:54:13 +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
c06b36a6ee MXS-1992 Remove place-holder for specific error handling 2018-08-08 09:17:58 +03:00
326bb88f70 MXS-1992 Expose config.cc:runtime_error as config_runtime_error 2018-08-08 09:17:58 +03:00
fbb79adc52 MXS-1992 Address review issues 2018-08-08 09:17:15 +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
dae6cf0648 MXS-1992 Allow the setting/getting of cache size at runtime 2018-08-08 09:16:19 +03:00
bb77ae7b95 MXS-1992 Rename internal/query_classifier.h to .hh 2018-08-08 09:16:19 +03:00
90569e3a28 MXS-1992 Expose qc stats in threads info
In principle it would be better if the qc information were
obtained via a specific query_classifier resource. However,
there are multiple problems with that (e.g. the qc has no way
of safely accessing information of another thread) and hence
the worker specific qc cache statistics is reported as part of
the worker statistics.
2018-08-08 09:16:19 +03:00
fbd3b08c1e MXS-1992 Make preparations for REST-API 2018-08-08 09:16:19 +03:00
1a7fa349fd MXS-1929: Use correct variable
The service capabilities were not set for filters as the name overlapped
with a local variable. The variable name was fixed but the actual use of
it was not.
2018-08-07 22:30:19 +03:00
93946375ca Ignore passwd in persisted configurations
If a passwd parameter is defined in a persisted configuration, it will be
ignored. This will make upgrades from 2.2 to 2.3 possible with persisted
configurations.
2018-08-07 22:30:18 +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
a1d5a06ba7 Use only backend DCBs with session_unlink_backend_dcb
The client DCB isn't in the set of DCBs managed by the session.
2018-08-06 21:20:29 +03:00
9d30c524e3 MXS-1929: Fix mock testing framework
The testing framework extended the public struct, not the private
one. Also moved the internal Session class inside the mxs namespace to
prevent conflicts with the mock testing Session class.
2018-08-06 21:20:29 +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
56ede5bbf4 MXS-1929: Remove string parsing from Service
As the filters are only passed as a pipe separated list when the
configuration is being processed, there's no need to have the interface
conform to that. Passing a list of filter names makes it more flexible and
will make it's use in the runtime configuration easier.
2018-08-06 21:20:29 +03:00
3a185902b7 MXS-1929: Implement filter destruction
Now that the filters are fully reference counted, their destruction is
trivially simple to implement.
2018-08-06 21:20:29 +03:00
0777de348b MXS-1929: Fix handling of version_string
The parameter was set to 5.5.5- if it wasn't defined.
2018-08-06 21:20:29 +03:00
356c607907 MXS-1929: Move global filter data into a struct
The global filter data is now stored in a single static struct.
2018-08-06 21:20:29 +03:00
10b01a7e91 MXS-1929: Store global service data in a struct
The this_unit struct in service.cc contains all global data used by the
services.
2018-08-06 21:20:29 +03:00
2e60d5fd71 MXS-1929: Store filters inside Session
The Session now holds a reference to the filters it uses. This makes the
use of filters safe even if they are destroyed mid-session.
2018-08-06 21:20:29 +03:00
7e64d6b3df MXS-1929: Move use of C++ inside the Session
The Session class now handles the work involved in dealing with the
private member variables.
2018-08-06 21:20:29 +03:00
945510e735 MXS-1929: Add Session class
The Session class now contains all of the C++ objects that were previously
in the MXS_SESSION struct. It is also allocated with new but all
initialization is still done outside of the Session in session_alloc_body.

This commit will not compile as it is a part of a set of commits that make
parts of the session private.
2018-08-06 21:20:29 +03:00
47176d9bf1 MXS-1929: Take local filter lists into use
The session creation function now uses the local filter list of the
worker. This also removes the need for the has_filters function.
2018-08-06 21:20:29 +03:00
f59fda0d9f MXS-1929: Move configuration dumping into Service
The service now generates the configuration file that represents the
serialized form of it. Also removed the unused service_serialize_servers
function.
2018-08-06 21:20:29 +03:00
478d07efc0 MXS-1929: Cache filter lists in workers
The services will now store a local copy of the filter lists in the worker
local data associated with the service. This removes the instance level
lock and removes the performance penalty that was previously imposed by
it.

The only remaining performance "regression" compared to 2.2 is the extra
two atomic operations per filter that a session does when it is being
created. This is quite hard to get rid of without significant amounts code
and will hopefully be just a drop in the ocean.
2018-08-06 21:20:29 +03:00
3038eb3326 MXS-1929: Move user reloading to Service
The Service class now handles the reloading of users. This removes the
need to expose the rate limits.
2018-08-06 21:20:29 +03:00