Commit Graph

6340 Commits

Author SHA1 Message Date
49aa23468d Align statistics to cache lines
Aligning the statistics object indices to cache line size reduces the CPU
overhead of gathering the statistics. This allows the statistics to more
accurately measure the polling system without the measurement affecting
the outcome.
2016-12-12 10:48:49 +02:00
5cb738ae03 Fix minor memory leaks
The main function and monitor creation both leaked a few bytes of memory.
2016-12-09 22:28:35 +02:00
50a9fb5ec1 Ignore deprecation warnings
Due to the restrictions imposed by various compiler versions, it's not
always possible to use non-deprecated functions.
2016-12-09 17:15:58 +02:00
9519be5e60 Cache: Use auto_ptr in storage_inmemory 2016-12-09 13:08:10 +02:00
16fad9c2cd Cache: Make storage_rocksdb exception safe
Now RocksDBStorage is exception safe in its own right, so exception
guards are only needed at the C/C++ boundary.
2016-12-09 13:08:10 +02:00
bf35577941 Cache: Take MXS_EXCEPTION_GUARD into use 2016-12-09 13:08:10 +02:00
ce94170eae Rename maxscale/cpp.hh to maxscale/cppdefs.hh
Just like every c-header must include maxscale/cdefs.h as the first
file, every C++-header must include maxscale/cppdefs.hh as its first
header.
2016-12-09 13:08:10 +02:00
f871664796 Cache: Rename all C++ headers from *.h to *.hh
Also remove some superfluous files and old include guards.
2016-12-09 13:08:10 +02:00
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
c421026ce9 Cache: Minor cleanup 2016-12-09 13:08:10 +02:00
e574af7e6e Cache: Derived CacheFilterSession from maxscale::FilterSession 2016-12-09 13:08:10 +02:00
8bbe80df99 Cache: Use MXS_EXCEPTION_GUARD and maxscale::SpinLockGuard 2016-12-09 13:08:10 +02:00
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
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
528531f3b5 Cache: SessionCache renamed to CacheFilterSession 2016-12-09 13:08:10 +02:00
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
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
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
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
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
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
fab7accef3 Cache: Collect RocksDB statistics 2016-12-08 14:58:59 +02:00
30074b7960 Cache: Add storage_inmemory documentation
Mostly a place-holder at the moment.
2016-12-08 14:58:59 +02:00
90e16d79c5 Cache: Collect storage_inmemory statistics 2016-12-08 14:58:59 +02:00
777ea3ef43 Make config_truth_value() const correct 2016-12-08 14:58:48 +02:00
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
66feeb8fbc Fix rwsplit debug assertion
A maximum of zero slaves is an accepted value.
2016-12-08 12:09:06 +02:00
941f0f9001 Cache: Collect LRU statistics 2016-12-08 11:26:46 +02:00
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
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
d9ced5bbab Fix binlogrouter build failure
The binlogrouter used the wrong variable name.
2016-12-08 10:11:55 +02:00
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
85d879e6ae Merge branch 'develop' into binlog_server_waitdata_encryption 2016-12-07 12:18:11 +01:00
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
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
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
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
8f86a596fa Add missing linkage to NullAuthAllow
The module did not link against the MySQLCommon library.
2016-12-06 20:27:51 +02:00
fcbea9fa40 Fix transaction tracking
If autocommit is disables, a transaction will always be open.
2016-12-06 20:27:51 +02:00
76a2475c33 Merge branch 'develop' into binlog_server_waitdata_encryption 2016-12-06 14:57:06 +01:00
9731bca42e Fix for rotate event
Fix for rotate event: missing offset results in wrong filename detection
2016-12-06 14:54:09 +01:00
4ae85dc754 Merge branch '2.0' into develop 2016-12-05 21:19:59 +02:00
b2e8a2d8c5 Develop merge
Develop merge:
this includes the new handling of events larger than 16MBytes
2016-12-05 16:38:48 +01:00
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
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
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
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
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
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
360d7d53b8 Fix call command error message
The error messages referred to functions and printed duplicate
information.
2016-12-05 13:18:20 +02:00