Commit Graph

205 Commits

Author SHA1 Message Date
75ea1b6ea1 Fix formatting of new(std::nothrow)
The code previously formatted everything as `new( std::nothrow)`.
2018-10-04 21:50:44 +03:00
9278da1f54 MXS-2067: Remove spinlock.h
Removed the spinlock.h header and replaced with plain pthread types and
functions.
2018-09-28 12:18:24 +03:00
ab4f870927 MXS-2067: Replace most SPINLOCKs
Replaced SPINLOCK with std::mutex where possible, leaving out the more
complex cases. The big offenders remaining are the binlogrouter and the
gateway.cc OpenSSL locks.
2018-09-28 12:18:23 +03:00
71ffef5708 Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
d11c78ad80 Format all sources with Uncrustify
Formatted all sources and manually tuned some files to make the code look
neater.
2018-09-10 13:22:49 +03:00
c81173e320 Move C++ code out of C headers
The additions into the server.h header used C++ language which caused C
programs to fail to compile. Moved the implementation of the EMAverage
class into the private Server class in the server.hh header and exposed it
via functions in the server.h header. Also temporarily moved
almost_equal_server_scores into the public server.hh as there is no
service.hh header.
2018-09-10 11:21:06 +03:00
c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00
1e6509423a MXS-1777: Add an EMAverage to the server struct, and a new slave selection criteria.
This is to support calculating the average from a session, and the slave selection criteria to be able to route based on averages. This commit, like the next one, have TODOs which you should feel free to comment on. Undecided things.
2018-09-05 17:05:06 +03:00
2b42011250 Merge branch '2.2' into develop 2018-09-03 10:48:26 +03:00
79ba89fba1 MXS-2034 Set query_retry_timeout
Was setting query_retry instead.
2018-09-03 10:46:32 +03:00
73288829b5 Remove default values for protocol
The parameter is the module name so it needs to be in the configuration.
2018-08-29 11:23:00 +03:00
9adc08a686 Move log initialization into a function
This will be of help when the implicit log initialization is added back.
2018-08-29 11:06:11 +03:00
25c0d3da14 Always treat unloadable modules as an error
When the loading of a module fails, be it due to a typo or a problem in
the library, the configuration is labeled as invalid.
2018-08-27 14:03:39 +03:00
a6bef0a80d Add credentials for remove REST API calls
The base URL and credentials used for REST API calls can now be defined in
the [maxscale] section. This allows encrypted passwords to be used.
2018-08-23 15:46:46 +03:00
1692765503 Enable query classifier cache by default
Enabling it will give a performance improvement and it offloads work from
the CPU. This leads to better and more complete utilization of system
resources.
2018-08-23 15:46:45 +03:00
3f53eddbde MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message] 2018-08-22 11:34:59 +03:00
b1e405442f MXS-2020 Replace ss_debug with MXB_AT_DEBUG 2018-08-22 11:34:06 +03:00
0d762b2019 MXS-2012 Remove old replication lag detection
The method was quite disruptive as it continuosly wrote to the database.
Also removed the MaxScale ID global, as it wasn't used for anything else.
2018-08-21 11:51:10 +03:00
e5c2b1a8c4 Create JSON serialization from object parameters
The services, monitors and filters now construct the JSON format
parameters from the configuration parameters. This reduces the need for
the amount of explicit operations and makes adding new parameters easier.
2018-08-20 13:56:59 +03:00
a9ff2a7056 MXS-1929: Serialize objects using parameters
The main "non-static" objects are now serialized using their
parameters. This makes it possible to use common code for most modules.
2018-08-20 13:56:59 +03:00
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
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
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
e075fcefcb MXS-2004 thread_stack_size is deprecated AND ignored 2018-08-13 13:38:39 +03:00
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
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
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
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
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
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
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
1b521b16a9 MXS-1992 Move QC json "parsing" to query_classifier.cc 2018-08-08 09:17:15 +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
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
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
d793fcbcb0 Remove element from CONFIG_CONTEXT
The variable was set but never used.
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
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
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
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
466e8a923c MXS-1992 Handle 'query_classifier_cache_size' parameter
No effect yet on the caching.
2018-08-01 11:10:34 +03:00
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
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
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
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
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
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