6332 Commits

Author SHA1 Message Date
Johan Wikman
3877d7bc5e Cache: Derive CacheFilter class from maxscale::CacheFilter
Now everything needed for cleanly transfer the control between the
C filter API of MaxScale and a C++ filter implementation is handled
automatically. Nothing of the earlier boiler-plate code is needed.
2016-12-09 13:08:10 +02:00
Johan Wikman
c421026ce9 Cache: Minor cleanup 2016-12-09 13:08:10 +02:00
Johan Wikman
e574af7e6e Cache: Derived CacheFilterSession from maxscale::FilterSession 2016-12-09 13:08:10 +02:00
Johan Wikman
8bbe80df99 Cache: Use MXS_EXCEPTION_GUARD and maxscale::SpinLockGuard 2016-12-09 13:08:10 +02:00
Johan Wikman
c9bc7a6e76 Cache: Separate C and C++ functionality
cache_storage_api.h contains pure C declarations, while
cache_storage_api.hh contains C++ declarations. Functions dealing
with CACHE_KEY moved to these headers.
2016-12-09 13:08:10 +02:00
Johan Wikman
855ed415f8 Add support for filters implemented in C++
C++ header files have the .hh-suffix to distinguish them from C
header files, but also to allow a C++ header file (e.g. xyz.hh) for
an existing C header file (e.g. xyz.h).

- cpp.hh        : Basic C++ stuff. Introduces the namespace "maxscale"
                  and its synonym "mxs".
- filter.[hh|cc]: Template class Filter and companion class FilterSession
                  to be used when implementing filters in C++.
- spinlock.h    : Wrapper and lock guard class for SPINLOCK.
2016-12-09 13:08:10 +02:00
Johan Wikman
528531f3b5 Cache: SessionCache renamed to CacheFilterSession 2016-12-09 13:08:10 +02:00
Johan Wikman
fcd737a0c9 Cache: It is a hit, also when a stale item is returned
Also add asserts for impossible cases.
2016-12-09 13:08:10 +02:00
Johan Wikman
ebca707335 QC: Always set number of returned items
qc_get_table_names() and qc_get_database_names() now always set
the number items, also in case of error. That is, it is now always
safe to start iterating using the number of items without first
checking the returned pointer.
2016-12-09 13:06:26 +02:00
Johan Wikman
12f0886ca2 Call destroyInstance after workers have exited
Router and filter instances cannot be destroyed before all worker
threads have exited. Otherwise there is a risk that data gets deleted
while someone might still be accessing it. Further, since all router
and filter instances are created by the main-thread it is better that
they are deleted by that thread as well (and not by whichever thread
happens to execute service_shutdown()). That will reduce the risk that
some unknown assumptions are violated.
2016-12-09 13:00:14 +02:00
Markus Makela
aa4ed2d28d Only add DCBs to the list that arean't in the list
Listeners are added to the list multiple times due to how DCBs are removed
from the list.  This requires that an additional check is made so that we
are sure a DCB will not be added to the list twice.
2016-12-08 17:29:43 +02:00
Markus Makela
570e12942b MXS-1047: Fix batch insert execution
Doing batch inserts though readwritesplit would stall due to the fact that
pending session commands were stored instead of executed immediately.

Session command responses that weren't complete also discarded the partial
event instead of storing it for later use.
2016-12-08 15:09:36 +02:00
Markus Makela
0e50ecb525 Detect session command replies with trailing data
When a session command was received, any trailing data was lost even
though an attempt to split is was made.

With this change, each session command reply will be routed individually
and any trailing data is routed separately.
2016-12-08 15:09:36 +02:00
Johan Wikman
fab7accef3 Cache: Collect RocksDB statistics 2016-12-08 14:58:59 +02:00
Johan Wikman
30074b7960 Cache: Add storage_inmemory documentation
Mostly a place-holder at the moment.
2016-12-08 14:58:59 +02:00
Johan Wikman
90e16d79c5 Cache: Collect storage_inmemory statistics 2016-12-08 14:58:59 +02:00
Johan Wikman
777ea3ef43 Make config_truth_value() const correct 2016-12-08 14:58:48 +02:00
Markus Makela
585c4554c8 Fix binlogrouter regression
Non-replication events were implicitly ignored but this was removed in a
recent change. The code that wasn't previously used didn't break the
replication event handling loop.
2016-12-08 12:24:50 +02:00
Markus Makela
66feeb8fbc Fix rwsplit debug assertion
A maximum of zero slaves is an accepted value.
2016-12-08 12:09:06 +02:00
Johan Wikman
941f0f9001 Cache: Collect LRU statistics 2016-12-08 11:26:46 +02:00
Johan Wikman
e0bedad46e Cache: Add information facilities
Various components of the cache can now provide information in
the form of a JSON object that then can be further processed.
2016-12-08 11:26:46 +02:00
Johan Wikman
8f2170c455 Add show command to cache filter
Initial POC implementation that is capable of outputting the
rules of the cache.

In order to do that conveniently, the json object is retained for
the lifetime of the CACHE_RULES object.
2016-12-08 11:26:46 +02:00
Markus Makela
d9ced5bbab Fix binlogrouter build failure
The binlogrouter used the wrong variable name.
2016-12-08 10:11:55 +02:00
Markus Makela
d42ef8ed13 Combine and rename session statement functions
There was no real need to have two separate functions for getting the
stored buffer and the target server. Combining them into one allows it to
be handled in a nicer way.
2016-12-08 10:07:48 +02:00
MassimilianoPinto
85d879e6ae Merge branch 'develop' into binlog_server_waitdata_encryption 2016-12-07 12:18:11 +01:00
MassimilianoPinto
9444ded6da Binlog encryption is now working with events larger than 16MBytes
Events larger than 16MBytes are now encrypted when being saved.

Some changes to binlog event details report and maxbinlogcheck supports
-H option for replication header display
2016-12-07 12:17:22 +01:00
Markus Makela
03e06727e8 Fix order of function declarations in session.h
A function was used before it was declared.
2016-12-07 10:58:01 +02:00
Markus Makela
8d539d9afb Improve transaction tracking fix
The previous fix can be implemented with less changes to actual code.
2016-12-07 10:39:16 +02:00
Markus Makela
6f7f8cae39 Add storing of statements to session
Statements can now be stored in the session object. This enables the
retrieval of these statements at a later time. These will be used by
readwritesplit to reroute failed reads to backup slaves.
2016-12-06 20:27:51 +02:00
Markus Makela
8f86a596fa Add missing linkage to NullAuthAllow
The module did not link against the MySQLCommon library.
2016-12-06 20:27:51 +02:00
Markus Makela
fcbea9fa40 Fix transaction tracking
If autocommit is disables, a transaction will always be open.
2016-12-06 20:27:51 +02:00
MassimilianoPinto
76a2475c33 Merge branch 'develop' into binlog_server_waitdata_encryption 2016-12-06 14:57:06 +01:00
MassimilianoPinto
9731bca42e Fix for rotate event
Fix for rotate event: missing offset results in wrong filename detection
2016-12-06 14:54:09 +01:00
Markus Makela
4ae85dc754 Merge branch '2.0' into develop 2016-12-05 21:19:59 +02:00
MassimilianoPinto
b2e8a2d8c5 Develop merge
Develop merge:
this includes the new handling of events larger than 16MBytes
2016-12-05 16:38:48 +01:00
Markus Makela
1a9232b152 Fix dbfwfilter rule syntax documentation
The documentation listed the rules as a comma separated list when they
were parsed as a whitespace separated list. The match specifiers were also
defined as optional when in fact they were mandatory.
2016-12-05 17:26:21 +02:00
Markus Makela
f5eb4e21dc Add more comments and clean up code
The binlog event processing code is now better commented and is slightly
easier to read.
2016-12-05 17:08:59 +02:00
Markus Makela
2f082cb7fb Store large events in memory
Storing the large events in memory allows checksum calculations to be done
in one step. This also makes the encryption of events easier as they
require the complete event in memory.
2016-12-05 17:08:59 +02:00
Markus Makela
83109a6e9e Use protocol module to process packets
The backend protocol module can be requested to provide complete and
contiguous packets to the router module. This removes the need to process
the packets in binlogrouter.
2016-12-05 17:08:59 +02:00
Markus Makela
21098e0a26 MXS-1045: Delete default SIGCHLD handler
If the default signal handler is not deleted for the original parent
process, the forked daemon process never receives the signals.
2016-12-05 15:03:21 +02:00
Markus Makela
d97e3587e0 MXS-878: Don't log an error for 10.1 slave connections
The error message was not needed as we know that the query is always
executed by 10.1 slaves.
2016-12-05 13:18:20 +02:00
Markus Makela
360d7d53b8 Fix call command error message
The error messages referred to functions and printed duplicate
information.
2016-12-05 13:18:20 +02:00
Markus Makela
6d7e419ed4 Improve --config-check mode
The configuration checking now detects bad router options. This allows for
better coverage of the configuration with only the --config-check flag.
2016-12-05 13:18:20 +02:00
ekorh475
a64825c866 Additions to QLA filter.
MXS-848 (partially). The QLA-filter now has additional options
to control the printing.
1. "append"
This toggles append-mode, where the filter opens the log files in
update mode (if file already existed) and only adds text to the end.
2. "print_service"
This toggles writing the service name onto each row. Mostly useful
with the unified_file-setting.
3. "print_session"
This toggles writing the session number onto each row. Mostly useful
with the unified_file-setting.

Also, the filter now writes a header to the beginning of the file
when creating it.

The printing has been separated to its own helper-function, in case
more accurate control will be added in the future.
2016-12-05 12:46:54 +02:00
Markus Makela
943aa48fb5 Make sure DCBs are OK before closing them
Added a check for the validity of the backend DCBs before they are
closed. This should guarantee that only valid DCBs are closed by
readwritesplit.

However, this is not the correct solution for the problem. The DCB should
not be in an invalid state in the first place and this fix just removes
the bad side effects of the double closing.

With the added logging in the readwritesplit error handler, more detailed
information should become available.
2016-12-04 06:35:35 +02:00
Markus Makela
9df3f154cf Detect duplicate objects
Creating a monitor or a listener twice is now detected and the proper
error is printed.
2016-12-03 11:31:18 +02:00
Markus Makela
be7a315614 Exit on bad maxadmin arguments
The errors were detected but the code proceeded to call various functions
with bad pointers. This led to a crash if a bad server name was given to
'show server'.
2016-12-02 19:08:54 +02:00
Markus Makela
a4bc575353 Remove direct freeing of sessions
Sessions are now always freed by releasing the last reference to it.
2016-12-02 15:19:44 +02:00
Markus Makela
b2e11d41d5 MXS-536: Add option to MySQLAuth that skips authentication
Disabling authentication in MaxScale allows creation of users which act
like wildcard users but require that the connection is made through
MaxScale.
2016-12-02 14:28:58 +02:00
Markus Makela
adbd666991 Change module command parameter types
This commit introduces safe session references that can be handled without
holding locks. This allows the safe searching of sessions with the unique
ID of the session.

Remove the use of raw pointers passed as strings. Change the comments of
the argument types and add more details to the parsing function
documentation.
2016-12-02 14:26:56 +02:00