Commit Graph

6561 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
dd372cda17 Use module parameters in maxrows
The maxrows filter now uses module parameters.
2017-01-09 14:17:33 +02:00
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
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
180ed1616a Add configuration test
The test validates, parses and creates configuration parameters for
modules.
2017-01-09 14:17:33 +02:00
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
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
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
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
7c13b56e74 Fix compilation error on CentOS6
Fix compilation error on CentOS6
2017-01-09 12:07:18 +01:00
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
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
9ba06f7c07 Fix merge issues 2017-01-09 09:37:11 +02:00
e7981c9d67 Masking: Handle NULL values properly 2017-01-09 09:26:43 +02:00
8127454f24 Masking: Add possibility to reload rules 2017-01-09 09:26:43 +02:00
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
224d0bcb35 Masking: Add proper rule matching and data rewriting 2017-01-09 09:25:26 +02:00
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
c25c0d688b Masking: Add startup handling to masking filter
- Process parameters
- Create config
- Load rules
2017-01-09 09:25:26 +02:00
171eb3f690 Provide backdoor to Buffer::iterator 2017-01-09 09:19:59 +02:00
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
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
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
0d561df880 QC: Implement qc_get_function_info for qc_sqlite 2017-01-09 09:17:38 +02:00
d078f56dc5 qc: Reveal function usage
MXS-1070

Just interface changes. Implementation follow in separate changes.
2017-01-09 09:17:38 +02:00
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
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
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
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
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
6a64de649b Increate parameter limit to 64
Modules can now declare up to 64 parameters.
2017-01-05 19:51:22 +02:00
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
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
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
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
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
9fa2de29d9 Return enum values as integers instead of strings
If the enums are converted to the acutual enum values before they are
returned, this removes the need for the modules to process the enum
strings to enum values. This allows modules to use enumerations with
minimal effort.
2017-01-05 19:51:22 +02:00
03391748ee Call [process|thread] [init|finish] functions of modules
The process initialization function was also renamed from init to
process_init.
2017-01-05 16:17:50 +02:00
a2a38f952a Add [process|thread] [init|finish] functions to modules
The MXS_MODULDE object now contains optinal pointers for functions
to be called att process and thread startup and shutdown. Since the
functions were added to the end, strictly speaking, all structures
would not have needed to have been modified, but better to be
explicit. In a subsequent change, these will be called.

C++ does not support flexible arrays, so for the time being C++
modules are restricted to 10 parameters. Better approach is to
factor out the parameters to a separate array and then just store
a pointer to that array in MXS_MODULE.
2017-01-05 14:44:02 +02:00
6a695c9407 Provide access to modules
With the provided functions it is possible to iterate over all loaded
modules or over all modules of a specific type.
2017-01-05 14:37:01 +02:00
2abe956056 Rename GWPROTOCOL to MXS_PROTOCOL 2017-01-05 14:36:44 +02:00
19ce28a43a Rename gw_protocol.h to protocol.h 2017-01-05 14:36:44 +02:00
1c8a4b13b9 Name variables the same way as the parameters
The variables now use the actual option and parameter names. This should
help make the code more readable and easier to understand in relation to
the used options.
2017-01-05 14:18:56 +02:00