6568 Commits

Author SHA1 Message Date
Markus Mäkelä
c06a95ff92 Use module parameters in binlogrouter
The binlogrouter accepts all router options also as parameters.
2017-01-10 16:52:29 +02:00
Markus Mäkelä
b352458870 Add size type to module parameters
The type represents byte sizes used for configuring buffers and file
sizes. The supported suffixes for binary units are k, m, g and t in both
upper and lower case.
2017-01-10 16:52:29 +02:00
Markus Mäkelä
2ee257eb48 Fix minor filter problems
Regexfilter tried to retrieve wrong parameter and the `options` parameter
was not added to the filters.
2017-01-10 16:52:28 +02:00
Markus Mäkelä
da5d53bbe0 Fix enum parameter checks
The enums weren't properly parsed when they were checked.
2017-01-10 16:52:28 +02:00
Markus Mäkelä
9803dc3f8c Fix build failure on Fedora 25
The std::tr1::shared_ptr needs to be explicitly used inside the function
or the std::tr1 namespace replaced with std:: namespace.
2017-01-10 16:52:28 +02:00
MassimilianoPinto
e0c33cbfee Add COM_STMT_EXECUTE support to maxrows
Prepared statements execution via COM_STMT_EXECUTE is now handled
2017-01-10 12:10:30 +01:00
MassimilianoPinto
45e26c63a5 Fix for bref_cmp_current_load() algorithm.
Fix for bref_cmp_current_load() algorithm when weight is present
2017-01-10 12:02:16 +01:00
MassimilianoPinto
f32471d1cb Fix for operations used instead of connections
Fix for operations used instead of connections in
bref_cmp_current_load()
2017-01-10 12:02:16 +01:00
MassimilianoPinto
a60a0032d1 Server weight is taken into account for LEAST_BEHIND_MASTER selection criteria
Server weight is taken into account for LEAST_BEHIND_MASTER selection
criteria
2017-01-10 12:02:16 +01:00
Markus Mäkelä
b507976414 Use a constant instead of a hard-coded parameter limit
Limits are better defined with constants that can be reused elsewhere.
2017-01-09 14:17:34 +02:00
Markus Mäkelä
d6d564c44d Use module parameters in topfilter and tpmfilter
The topfilter and tpmfilter now use the module parameteres.

Also removed some unnecessary variables and included maxscale/cdefs.h in
tpmfilter.
2017-01-09 14:17:34 +02:00
Markus Mäkelä
e6b7035766 Use module parameters in regexfilter and tee
The regexfilter and tee now use the module parameters.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
92386922a9 Use module parameters in qlafilter
Moved the qlafilter parameters to module options. This removes the need to
parse the options in the filter.

Split the options into separate parameters. This allows common options to
be combined as enumerations under common parameters.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
c500ddc768 Use module parameters in namedserverfilter
The namedserverfilter module now uses the module parameters.

Added new server type parameter which is validated both at startup and
runtime.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
9b2d382232 Use module parameters in mqfilter
Cleaned up mqfilter createInstance and converted it to use module
parameters.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
dd372cda17 Use module parameters in maxrows
The maxrows filter now uses module parameters.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
f156b1e4ee Add minimum and maximum values for integer parameters
The defined integer values can be used to give a default value the maximum
for its type.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
11ab4575c3 Use module parameters in ccrfilter and luafilter
The ccrfilter and luafilter now use the module parameters.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
180ed1616a Add configuration test
The test validates, parses and creates configuration parameters for
modules.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
56ecdc219b Refactor config.c functions for testing
To test the configuration validation and default value generation, the
functions needed to be refactored to allow parameters to be passed
directly to the function.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
eef0619865 Add default parameters to created monitors
When a monitor is created at runtime, it also needs to have the default
parameters. Ideally, this would be done when the monitor is allocated but
because of the way the configuration is processed, we need to do it after
user defined parameters are added.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
72ea3ad453 Fix improper use of monitorStart
Some uses of monitorStart didn't pass the monitor parameters to the
function call. This caused runtime configuration of monitors to not have
any parameters as they never got their parameters.
2017-01-09 14:17:33 +02:00
Johan Wikman
75c257327e Fix G++ 4.4 issue
G++ 4.4 on CentOS6 seems to get confused by direct inheritance
from templates. Worked around by introducing typedef.
2017-01-09 13:17:49 +02:00
MassimilianoPinto
7c13b56e74 Fix compilation error on CentOS6
Fix compilation error on CentOS6
2017-01-09 12:07:18 +01:00
Johan Wikman
c3ddc3ac22 Cleanup server.h
- All (but the printing/debug functions) are now in snake_case.
- Functions made const correct.
- All function prototypes now have named arguments.

Documentation still to be moved, and file possibly split into
include/mascale/server.h and server/core/maxscale/server.h
2017-01-09 12:14:46 +02:00
Esa Korhonen
1b8742781b MXS-804 Handle hosts of form ip/netmask
Previously, these were discarded. This patch adds a function to
"merge" the mask to the ip so that it's in the form which
normalize_hostname expects (using % as wildcard). Only simple masks
with 255:s and 0:s are accepted. Any other combinations may leave
the hostname in a garbled state which will cause it to be discarded
later.
2017-01-09 10:05:35 +02:00
Johan Wikman
9ba06f7c07 Fix merge issues 2017-01-09 09:37:11 +02:00
Johan Wikman
e7981c9d67 Masking: Handle NULL values properly 2017-01-09 09:26:43 +02:00
Johan Wikman
8127454f24 Masking: Add possibility to reload rules 2017-01-09 09:26:43 +02:00
Johan Wikman
ad4cc7bbac Masking: Add matching and rewriting functionality
This change now ties the pieces together and implements tha
functionality required of the masking filter. Note thought that
this is still work in progress and changes will follow.
2017-01-09 09:25:26 +02:00
Johan Wikman
224d0bcb35 Masking: Add proper rule matching and data rewriting 2017-01-09 09:25:26 +02:00
Johan Wikman
f74d267766 Add helper classes for MySQL protocol handling
- LEncInt     : Class for dealing with length encoded integers
- LEncString  : Class for dealing with length encoded strings
- ComPacket   : Base-class for all packet classes.
- ComRequest  : Base-class for all requests.
- ComResponse : Base-class for all responses.
- ComQueryResponse
- ComQueryResponse::ColumnDef
- ComQueryResponse::Row

Common to these all is that they are very thin, and basically only
make it easier to what anyway needs to be done, if the equivalent
is used by directly accessing the packet buffer.

Now these are private for the masking filter, but may be moved under
masxcale/include if/when the general usefulness has been established.
2017-01-09 09:25:26 +02:00
Johan Wikman
c25c0d688b Masking: Add startup handling to masking filter
- Process parameters
- Create config
- Load rules
2017-01-09 09:25:26 +02:00
Johan Wikman
171eb3f690 Provide backdoor to Buffer::iterator 2017-01-09 09:19:59 +02:00
Johan Wikman
dc87663c95 Masking: Add MaskingRules
MXS-910: Initial implementation of rule handling, now only the
parsing of JSON file and the building of corresponding objects.
Rudimentary testing.
2017-01-09 09:19:59 +02:00
Johan Wikman
0b4c379539 Add Closer, partial RAII class
Closer is a template using which C-style resources can be managed
in a C++ context where exceptions can occur. By placing a C resource
in a Closer instance, it is certain the resource will be freed when
the closing scope is exited irrespective of whether that occurs due
to the normal control flow, due to a return statement or an exception
having been thrown.

To be used with Closer, the CloserTraits template must be specialized
for the type in question. With this change specializations are provided
for FILE*, json_t*, pcre_code* and pcre2_match_data*.
2017-01-09 09:19:59 +02:00
Johan Wikman
482fbe6400 qc: Implement qc_get_function_info for qc_mysqlembedded
MXS-1070

Now both qc_mysqlembedded and qc_sqlite return the same stuff
for the same statement, and both include also operators in
addition to pure functions. Whether that is the right approach,
is still subject to debate.

However, if we want to make it possible to disable e.g. the
use of concat as in "select concat(a) from t", where a is a string,
to prevent the bypassing of the masking filter, then conceptually
it should be possible to prevent "select a+0 from t", where a is an
int, as well.
2017-01-09 09:17:38 +02:00
Johan Wikman
0d561df880 QC: Implement qc_get_function_info for qc_sqlite 2017-01-09 09:17:38 +02:00
Johan Wikman
d078f56dc5 qc: Reveal function usage
MXS-1070

Just interface changes. Implementation follow in separate changes.
2017-01-09 09:17:38 +02:00
Johan Wikman
2d849e0ab2 Remove MySQL dependency from gateway.cc
The MySQL initialization is now performed by the MySQLClient module.
2017-01-09 09:16:35 +02:00
Johan Wikman
8fc5bdc2f1 Perform query classifier initialization implicitly
The setting up and the initialization of the query classifier has
now been separated. The gateway explicitly sets up the query
classifier (i.e. chooses which one to use and what arguments to
provide), but the actual initialization is performed as part of
the general module initialization.
2017-01-09 09:16:35 +02:00
Johan Wikman
530c0e9617 QC: Setup and initialization separated
This is in preparation for using the general process/thread
initialization mechanism.
2017-01-09 09:16:35 +02:00
Markus Mäkelä
a0181133fe Only install /var/lib/maxscale for core package
All RPM packages tried to install the /var/lib/maxscale directory when
they shouldn't have.
2017-01-05 22:42:56 +02:00
Markus Mäkelä
915eeabe25 Use module parameters for cache filter
The cache filter now uses the module parameters. Due to the relative path
support for the `rules` parameter, it is still manually parsed.

The `storage_options` list is also manually parsed. The core could
possible parse simple comma separated lists and return them as a string
array. This should be done in a later commit.
2017-01-05 19:51:22 +02:00
Markus Mäkelä
6a64de649b Increate parameter limit to 64
Modules can now declare up to 64 parameters.
2017-01-05 19:51:22 +02:00
Markus Mäkelä
2611f9a701 Give parameters as CONFIG_PARAMETER for FILTER::createInstance
The filters should use the same configuration parameters as other modules
use. This allows them to use the common configuration management functions
to get values from it.
2017-01-05 19:51:22 +02:00
Markus Mäkelä
e75cdb2ceb Use module parameters in schemarouter
The schemarouter now accepts all router_options values as parameters.

Also fixed a mistake in the documentation where the router options section
was listed twice.
2017-01-05 19:51:22 +02:00
Markus Mäkelä
34a8694b34 Use module parameters for readwritesplit
The parameters that readwritesplit uses now use the new system. This
removes the need for the qualified parameter processing found in config.c.

All values for router_options are now also accepted as parameters. The
router_options is deprecated and support for it will be removed in a
future version.
2017-01-05 19:51:22 +02:00
Markus Mäkelä
f1fa982dc6 Remove qualified configuration parameters
The parameters were only used by readwritesplit. These can be substituted
with the new module parameters.
2017-01-05 19:51:22 +02:00
Markus Mäkelä
ae31e3b0b5 Only add default value if none is provided
The default parameter values should only be added if the configuration
doesn't have that parameter.
2017-01-05 19:51:22 +02:00