185 Commits

Author SHA1 Message Date
Johan Wikman
cf0aeed516 MXS-2014 Rename log_manager.h to log.h
There's nothing resembling a manager anymore.
2018-08-17 10:59:37 +03:00
Markus Mäkelä
0c2bec9fba
MXS-1929: Add config dump helper functions
The functions dump of parameters only if they differ from the
defaults. The check for equality is rather coarse but it should work as
long as all core objects use C++ types correctly e.g. integer are not used
to store boolean values (I'm looking at you, enable_root and
localhost_match_wildcard_host). The boolean type has a specialization to
convert the value to the string format used for all defaults in the core.

This also adds the missing return value checks to the dprintf calls and
reports errors if any are encountered.
2018-08-14 21:51:58 +03:00
Markus Mäkelä
32b1711684
MXS-2005: Remove logging to shared memory
The feature was rarely used and was only useful in extremely rare
cases. The functionality can still be emulated, if for some reason needed,
by pointing `logdir` to `/dev/shm` or another tmpfs mount.
2018-08-14 14:57:33 +03:00
Johan Wikman
e075fcefcb MXS-2004 thread_stack_size is deprecated AND ignored 2018-08-13 13:38:39 +03:00
Johan Wikman
6db03d4b29 MXS-2004 Drop support for thread_stack_size
- Cannot be supported with std::thread.
- Unlikely that the default size (8MB) would ever be too small and
  if it is, there is some problem.
- The stack size can be specified using 'ulimit -s' before starting
  MaxScale.
2018-08-13 13:38:39 +03:00
Esa Korhonen
eab0a22518 Use parameters list when converting monitor parameters to json
The json conversion now processes the general monitor parameters similarly
to the module-specific settings.
2018-08-13 11:18:04 +03:00
Markus Mäkelä
4a47b4f334
Fix ssl_version
The parameter used wrong keywords for the enum values. The comparison
should be changed to be case-insensitive to prevent similar problems.
2018-08-13 10:28:04 +03:00
Esa Korhonen
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Johan Wikman
2539183be2 MXS-2000 Add query_classifier_cache_size to maxscale resource 2018-08-09 08:37:44 +03:00
Johan Wikman
1b521b16a9 MXS-1992 Move QC json "parsing" to query_classifier.cc 2018-08-08 09:17:15 +03:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
d793fcbcb0
Remove element from CONFIG_CONTEXT
The variable was set but never used.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
a252b45f18
Don't use auto&& in non-template code
Use explicit types instead.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
ea8b522c8a
MXS-1929: Combine service creation and configuration
The servers and filters are taken into use immediately after the service
is created. This removes the need for a second configuration step.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
47c89d5b89
Remove duplicate variable
Caused by rebasing changes. Also fixed the comment to reflect the current
situation.
2018-08-01 15:06:39 +03:00
Markus Mäkelä
a0b0f7993e
Create servers in configuration order
As we know servers don't have dependencies, we can construct them in
configuration file order.
2018-08-01 15:02:02 +03:00
Johan Wikman
466e8a923c MXS-1992 Handle 'query_classifier_cache_size' parameter
No effect yet on the caching.
2018-08-01 11:10:34 +03:00
Markus Mäkelä
cc2ae7a0cb
Resolve object dependencies
When the configuration was loaded, the dependencies were resolved at the
time the objects were constructed. To remove the need to check whether a
dependency exists at object creation time, the dependencies can be
resolved by the core as a part of the configuration processing.

The circular dependency resolution uses a template function to solve the
problem in a generic fashion. This might be slightly overkill but it is a
good way to test the waters and see whether the functon would be usable in
as a utility function.

Only explicit object dependencies are resolved. If a module declares a
parameter as a string but uses it like an object name, the dependency is
not resolved and can fail.

As the dependency resolution uses Tarjan's algorithm, it has a side-effect
of creating the correct order of objects to meet their dependencies.
2018-07-31 22:32:30 +03:00
Markus Mäkelä
d95b1f834d
Factor out module parameter set extraction
Factored out the extraction of the parameter set that a module has. Also
cleaned up the configuration to use STL containers and types.
2018-07-31 22:32:30 +03:00
Markus Mäkelä
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
Markus Mäkelä
a833f39196
MXS-1929: Load global configuration as soon as possible
There exists a dependency on the configuration for the workers: the total
number of worker thread is defined by the `threads` parameter. This means
that the global configuration section must be read before workers are
started.

Commit 411b70e25656317909e54f748f8012593120041f broke MaxScale and turned
it into a single threaded application as the default configuration value
of one worker was used.
2018-07-31 09:41:14 +03:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
c31e78754d
Fix object name tokenization
Spaces must be considered a part of the object name in tokenization. This
ensures that the name normalization process generates correct names and
that tokens are split at correct places.
2018-07-17 11:52:23 +03:00
Markus Mäkelä
728a3f6957
Clean up filter usage in services
Using a stack-allocated vector allows the filter definition array to only
be allocated once all filters have been successfully processed.
2018-07-17 11:52:22 +03:00
Markus Mäkelä
16aece6f83
Clean up new service configuration
Removed redundant checks and dead code, replaced manual server searches
with correct ones.
2018-07-17 11:52:22 +03:00
Markus Mäkelä
4e8ac8dd4f
Fix explicit server allocation
The test cases allocated servers in a way that doesn't comfortably suit
the way the servers are now allocated. Adding a helper C++ class to load
module defaults makes it easier to do explicit server initialization in
tests.

The binlogrouter was also fixed in this commit as it uses servers much
like a test would use.
2018-07-17 11:52:21 +03:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
177f7357e0
Use module-style parameters with filters
Filters now use the module-style parameters to automate the type checking
and default value assignment.
2018-07-17 11:52:19 +03:00
Markus Mäkelä
ddaf300783
Fix and improve configuration validation
The parameter type and value validation is now fully done for the base
module parameters as well. This fixes a problem that was introduced when
the listeners were moved to the module parameter system where the
`service` parameter values weren't fixed for the new naming style.

Added an explicit check for the module type that catches errors in the
type parameter. The lack of this parameter prevents the proper detection
of other parameters.

Also cleaned up and/or removed redundant sections of code. By treating
reserved parameters the same way as module declared ones, the same code
can be re-used for all types.
2018-07-17 11:52:18 +03:00
Markus Mäkelä
421282421c
Use module-style parameters with listeners
Listeners now use the module-style parameters to automate the type
checking and default value assignment.
2018-07-17 11:52:18 +03:00
Markus Mäkelä
5fdf82a508
Only warn about whitespace in section names
The warnings were logged even when the fix_section_name function was used
to fix non-section names.
2018-07-17 11:52:15 +03:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
e2fb0093b1
Merge branch '2.2' into develop 2018-07-12 19:38:40 +03:00
Markus Mäkelä
71c736faec
Initialize router parameters in service_alloc
By moving the router parameter initialization into service_alloc, the
creation of a new service can be simplified to a single function call.
2018-07-11 14:08:56 +03:00
Markus Mäkelä
81527894ee
Remove filter options
None of the filters used the options. The filter API version was already
incremented once for 2.3 so there's no need to increment it again.
2018-07-11 14:08:56 +03:00
Markus Mäkelä
cbb8c68770
Remove router_options
Relaced router_options with configuration parameters in the createInstance
router entry point. The same needs to be done for the filter API as barely
any filters use the feature.

Some routers (binlogrouter) still support router_options but using it is
deprecated. This had to be done as their use wasn't deprecated in 2.2.
2018-07-11 14:08:56 +03:00
Markus Mäkelä
b320217212
Remove configuration reloading
Removed the deprecated configuration reloading code. Added a entry into
the release notes that states this and the fact that it was deprecated in
2.2.
2018-07-11 14:08:54 +03:00
Markus Mäkelä
2df5763b6c
Add configuration exporting
The runtime configuration of a MaxScale can now be exported to a single
file. This allows modifications made via runtime configuration commands to
be "committed" for later use.
2018-07-07 09:28:50 +03:00
Johan Wikman
f2b8487577 MXS-1624 Add configuration parameter
With the global configuration parameter 'query_classifier_cache'
the query classification cache can be turned on. At the moment it
does not matter what value it has; its presence simply enables the
caching.

Eventually you will be able to specify how much memory the cache
is allowed to consume.
2018-07-06 12:12:31 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
396f5d96c2
Merge branch '2.2' into develop 2018-06-20 14:43:03 +03:00