Commit Graph

2997 Commits

Author SHA1 Message Date
d0cc246b79 Rename FILTER to MXS_FILTER 2017-01-13 10:21:51 +02:00
e7b951c434 Rename FILTER_OBJECT to MXS_FILTER_OBJECT
Other clarifications to follow.
2017-01-13 10:03:23 +02:00
463b2fb468 Remove relative path processing from filters
The filters don't need to process relative paths as the core handles
that. All path parameters are interpreted as relative to the module
configuration directory, /etc/maxscale.modules.d/.
2017-01-12 15:33:48 +02:00
e1a43c15c5 Masking: Add error handling
When receiving an error packet, we just abort whatever we were doing.
2017-01-12 14:44:04 +02:00
9a85b8eb06 Masking: Handle multi results 2017-01-12 14:44:04 +02:00
9a95e79dd6 Masking: Add parameter for warnings
The masking filter can now be instructed to warn in case a masking
rule matches a column of a type that is not masked.
2017-01-12 14:41:55 +02:00
3acb43e2ed Address only specific type of columns when masking
Only columns that are of string kind are now subject to masking.
With a textual resultset it would be possible to mask anything the
same way, but with a binary resultset it is not. Thus, so that the
result is not dependent upon whether the resultset happens to be
textual or not, only string fields are accessed. Documentation to be
updated in a separate change.

The utility classes have now also been rearranged somewhat.
2017-01-12 14:41:55 +02:00
10ba67be3c Handle binary resultsets in maskingfilter 2017-01-12 14:40:16 +02:00
43c81baf70 Add utility classes for dealing with binary resultsets 2017-01-12 14:40:16 +02:00
2fa12f796b Rename MYSQL_GET_PACKET_LEN to MYSQL_GET_PAYLOAD_LEN
The function returns the length of the payload, not the length of
the entire packet.
2017-01-12 14:24:14 +02:00
77aff88ed7 Maxbinlogcheck gets stuck when binlog file is not existant/readable
Missing exit() caused maxbinlogcheck being stuck on log_manager call
when specified binlog file is not existed/redable
2017-01-11 15:30:57 +01:00
a196420c2d Move monitor script processing and launching into the core
This removes parts of the nearly identical code from all monitors.

The removal of monitor type specific event checking is done based on the
assumption that only the monitor that is monitoring the server can be the
cause for a state change. This removes the need to actually check that the
state change is relevant for each monitor and allows the event handling to
be moved into the core.
2017-01-11 14:21:57 +02:00
7ef5e4bfd9 Use module parameters in maskingfilter
The maskingfilter still does some processing due to the fact that it
accepts relative pathnames. This should ideally done by the core in a
controlled manner and for all path parameters.
2017-01-11 13:06:40 +02:00
8612561bbd Fix placement of default 2017-01-11 13:02:19 +02:00
0c6739ebd3 Use config_copy_string in luafilter
The function is intended to be used with string parameters that are
optional and are copied when defined. This removes the need to copy the
string to a local variable to perform checks on the value.
2017-01-10 20:50:12 +02:00
dffad71804 Add support for comparison operators in dbfwfilter functions
The dbfwfilter now supports the main comparison operators in MySQL. The
string versions (IS, NOT, IS NOT etc.) are not supported.
2017-01-10 16:52:29 +02:00
6c9a80e957 Log a message when rules are reloaded
When the rules are reloaded, it is prudent to log a message. This will
help in the analysis of logs.
2017-01-10 16:52:29 +02:00
cad7b6446d Move dbfwfilter rule matching into subfunctions
This makes the code more readable.
2017-01-10 16:52:29 +02:00
67894b2c7b Prevent prepared statement use with dbfwfilter
Since the prepared statements can't be processed, they should not be
allowed.
2017-01-10 16:52:29 +02:00
1ceafb9723 Add function blocking to dbfwfilter
The dbfwfilter now supports blocking of individual functions.
2017-01-10 16:52:29 +02:00
990ecfc114 Use module parameters in dbfwfilter
The dbfwfilter now uses module parameters.
2017-01-10 16:52:29 +02:00
73a1388468 Check and create binlogdir and avrodir before use
The binlog and avro file directories should be checked before they are
used and if they don't exist, they should be created.
2017-01-10 16:52:29 +02:00
c06a95ff92 Use module parameters in binlogrouter
The binlogrouter accepts all router options also as parameters.
2017-01-10 16:52:29 +02:00
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
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
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
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
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
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
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
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
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
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
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
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