Commit Graph

6355 Commits

Author SHA1 Message Date
a0f6dd8abc Fix crash on double creation of listeners
When the listeners were created twice, MaxScale would crash when the users
were loaded. This is caused by the fact that the DCB for the listener is
NULL for failed listeners.
2016-12-13 09:12:58 +02:00
7a04259fc0 MXS-756: Retry reads on slave failure
If a slave fails while a non-critical read is being executed, the read is
retried on a different server. This is controlled by the new
`retry_failed_reads` option.

Only selects done that are done outside of a transaction and with
autocommit enabled are retried.
2016-12-13 09:12:58 +02:00
a66c8fb919 Fix crash on NULL client DCB in mysql_backend.c
It is possible that a session is in the dummy state (a transient state)
when a backend write occurs. The check for the client protocol NULL-ness
should extend to the client DCB itself.
2016-12-13 08:28:57 +02:00
101fc82fa0 Documentation update for maxbinlogcheck utility
New options related to encryption: -K and -A.
Binlog event header is printed with -H option
2016-12-12 22:00:11 +01:00
ff4d56813e MaxRows filter can handle 16MBytes packets
16 MBytes and larger packet are handled.
Note: a 16MBytes packet is seen as a row by the filter.
2016-12-12 22:00:11 +01:00
38af20569c MaxAdmin defaults to Emacs-mode and other small changes
1. MaxAdmin now defaults to Emacs-mode. To activate Vim-mode, give
the option 'i' when starting.
2. "history" and "source"-commands are parsed correctly.
3. Added a check to DoSource() so that empty commands are not sent.
MaxScale doesn't respond to empty commands which would cause MaxAdmin
to wait forever.
2016-12-12 17:34:35 +02:00
259e944b3d Server status changes now happen under a lock
MXS-873 To prevent monitors and MaxAdmin from interfering with each other,
changes to the server status flags now happen under a lock. To avoid
interfering with monitor logic, the monitors now acquire locks to all
of their servers at the start of the monitor loop and release them
before sleeping.
2016-12-12 15:04:05 +02:00
162ae04d20 MXS-867: Binlog server encryption key has same format as MariaDB key file
Default algorithm is now AES_CBC.
The MariaDB 10.1 key file cannot be read as it might contain more than
1 rows.
2016-12-12 14:01:54 +01:00
5ccdfe54bd Hack binlogrouter to work with resultset buffering
The binlogrouter needs to manipulate the protocol structures in order for
the resultset buffering to work correctly. If the state isn't manipulated
for COM_QUERY statements, the resultsets aren't buffered and will be
routed in separate buffers.
2016-12-12 11:56:41 +02:00
03681db687 Fix crash with binlogrouter
If the client protocol isn't set, the command shouldn't be either.
2016-12-12 11:55:49 +02:00
0b44fe1c04 Only buffer result sets for COM_QUERY statements
When a non-COM_QUERY statement is sent, the result set should not be
buffered.
2016-12-12 11:39:54 +02:00
106f482f45 Add result set buffering to MySQLBackend
The backend MySQL protocol module now supports a new routing capability
which allows result sets to be gathered into one buffer before they are
routed onward. This should not be used by modules that expect large
result sets as the result set is buffered in memory.

Adding a limit on how large of a result set could be buffered would allow
relatively safe use of this routing capability without compromising the
stability of the system.
2016-12-12 10:48:53 +02:00
d543ecb483 Remove servers from destroyed monitors
A destroyed monitor should not have any servers added to it. This allows
the servers that once were monitored by a destroyed monitor to be added to
new monitors.
2016-12-12 10:48:53 +02:00
cb218804ef Detect double monitoring of servers
Adding a server to multiple monitors is forbidden. This should be detected
and reported to the end user.

The information provided by the config_runtime system to the client isn't
as detailed as it could be. Some sort of an error message stack should be
added so that client facing interfaces could properly report the reason
for the failure. Currently the only way to detect the reason of the
failure is to parse the log files.
2016-12-12 10:48:53 +02:00
312cf69739 Log a message for every online change
All changes made to the configuration should be traceable. This makes the
process of understanding the life-cycle of a specific MaxScale
installation easier.
2016-12-12 10:48:53 +02:00
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