The dbfwfilter now uses flex to tokenize the rules and bison to process those
tokens into a language. This will make the syntax checks more robust and
the rule language easier to maintain. It also makes the processing of rules
easier to understand and removes most of the C language side checks for
correctness.
The old rule processing functions are still left intact and will be removed
at a later point.
When configured to log matching queries, the dbfwfilter will log all queries
that match a rule. The rule name, user name and the query itself are logged.
It is also possible to match all queries that do not match a rule. Only the user
name and query is logged in this mode.
Now, qc_mysqlembedded is linked against MySQL's embedded library,
and MaxScale itself against Connector-C.
So, in order to build MaxScale, Connector-C must be installed.
This has been tested with Connector-C 2.2.1.
The build variable MYSQLCLIENT_LIBRARIES is no longer used.
Only the query classifier needs the functionality of the embedded
server, while the rest of MaxScale is content with the client
library or Connector/C.
This have now been rearranged so that query-classifier links with
the embedded static library and then explicitly exports its own
functions using the query_classifier.map linker script. That way
query classifier will use the embedded library, while the rest of
maxscale use the client library, and this without conflicts.
Currently, query_classifier is not linked to maxscale-common,
but executables must link to maxscale-common and query_classifier.
This is the first change in an attempt to arrange the linking so that
more errors are detected at link-time.
- All files in server/core but for gateway.c are linked to one shared
library called maxscale-common.
- The files log_manager/log_manager.cc and utils/skygw_utils.cc are
built into maxscale-common as well.
- MaxScale itself consists now only of gateway.c and is linked with
maxscale-common.
- All plugins link with maxscale-common.
- All executables link in addition with {EMBEDDED_LIB}.
After this change, the change (MXS-517) where query_classifier is the
only component that uses ${EMBEDDED_LIB} and the rest mysqlclient can
be made much cleaner.
After a few additional steps, all shared libraries can be linked with
the linker flags "-Wl,-z,defs", which directs the linker to resolve
all symbols. That will require that all shared libraries list all the
libraries they need, but will at the same time ensure that any
missing symbols are detected at link-time and not at run-time.
Since the PCRE2 library was always going to be a part of MaxScale, there was
no real reason to have it as a shared library apart from smaller binaries.
The username matching was working as intended but the session's active value
was ignored when queries were being routed. This meant that both the username
and the IP address of the user were ignored and query replacement was always
done.
Made some variables stack allocated so there is no change of memory leaking.
There was no real reason to allocate memory from the heap for the variables in
question since they did not need to persist outside the scope of the function.
Some of the data was not reset for the branch session when a query
was not duplicated which could lead to a hang. Also the COM_FIELD_LIST
duplicated to the branch session even though it doesn't change the
session state.
If a statement wasn't cloned for the Tee filter, the session would be closed
leading to a possible hang. Instead of closing the session when a statement
isn't cloned, it should not expect a response from that server for that statement.
The soname version numbers were missing from all the library targets
properties which caused ldconfig to warn about non-symlink libraries
being installed.
The 0.6.0 version of librabbitmq-c added two parameters to amqp_exchange_declare
which allow auto-deleted and internal exchanges. This change requires more
advanced version detection so that code could be conditionally compiled for
newer versions of the library.
The limit_queries parsing used a bad initial value for the return value
which lead to a guaranteed failure. Other parts of the code used wrong values
for comparisons leading to sporadic parsing errors.
The mqfilter was not built by default even though it should have been. This has
been fixed but the filter is built only if librabbitmq is found. This was done
to avoid having the librabbitmq and its development headers as a hard
dependency.
A large part of parse_query was parsing of the actual rule definitions. This made
the function very large and hard to understand. For this reason the definition parsing
was moved to its own function.
Since localtime is not thread-safe it should not be used in multithreaded
contexts. For this reason all calls to localtime were changed to localtime_r
in code where concurrency issues were possible.
Internal tests were left unchanged because they aren't multithreaded.
The bundled PCRE2 library will be built as a separate target and configuring
CMake no longer builds it. Instead, it will only be built when it is out of date.
This requires all targets to declare that they depend on the pcre2 target in
order for it to be built.