2542 Commits

Author SHA1 Message Date
MassimilianoPinto
5d5b2c9d6c Binlog file is checked at max scale startup if encryption is enabled
Binlog file is checked at max scale startup if encryption is enabled.

The check might fail while calculating next pos or verifying event type.
A message is reported
2016-11-30 09:01:42 +01:00
MassimilianoPinto
abd73f3700 blr_read_binlog checks replication header after decryption
blr_read_binlog can now check the  replication header after decryption,
for encrypted events.

Added a small fix for slave server requesting position of
START_ENCRYPTION_EVENT: new pos points to first encrypted event.
2016-11-29 17:57:32 +01:00
MassimilianoPinto
c7c68410be Merge branch 'develop' into binlog_server_waitdata_encryption 2016-11-29 17:38:04 +01:00
Markus Makela
4ff4e69592 Add stopping and starting of listeners to maxadmin
Listeners can now be stopped and started individually.
2016-11-29 15:04:19 +02:00
Markus Makela
ecdeb009b3 Fix dbfwfilter regression
The query throttling functionality was broken by the move to the per
thread rule system. One way to fix this is to move the session specific
throttling information into the client session itself. This allows for a
simpler system with no direct dependencies on the rules or users
themselves.
2016-11-29 14:19:08 +02:00
Markus Makela
075968e947 Allow avrorouter converstion to be started and stopped
The modulecmd functionality allows the avrorouter to easily control the
conversion process with one command. The conversion can now be started and
stopped by the user.

This also fixes a bug where the conversion would stop if there were no
binlog files present when the service was started.
2016-11-29 14:19:08 +02:00
ekorh475
05303f5b7e Fix memory leaks in maxinfo (modified for develop-branch)
MXS-1009. This commit adds a gwbuf_free after maxinfo_execute() to
free a buffer with an sql-query after it has been processed. Also,
the parse tree in maxinfo_execute_query() is now freed. The tree_free-
function was renamed to maxinfo_tree_free, since it is now globally
available.

This commit has additional changes (in relation to the 1.4.4 branch)
to remove errors caused by differences in the html and sql-sides of
MaxInfo.
2016-11-29 13:08:20 +02:00
MassimilianoPinto
241fa67cfc AES_CBC is now supported for binlog encryption
AES_CBC can be used for binlog files encryption

The AES_CBC could leaves some not handled bytes in the buffer and those
need a special encoding (ECB and XOR)

This way the output buffer of the whole encoding with AES_CBC will have
same size as the input (AES_CTR does it without any other step)
2016-11-29 11:09:11 +01:00
Johan Wikman
fa58fdcde8 Cache: Make Storage abstract
Storage is now abstract with StorageReal (that uses an actual
storage module) derived from it. This to prepare for a stackable
case where LRU behaviour is implemented in front of the actual
physcal storage.
2016-11-29 11:23:23 +02:00
Johan Wikman
b4ddf23ba3 Cache: Now uses unordered_map instead of HASHTABLE 2016-11-29 11:23:23 +02:00
Johan Wikman
02265c5dc2 Cache: All functions now named using snake case
Exception is where the call goes across a plugin boundary, as
is the current MaxScale convention.
2016-11-29 11:23:23 +02:00
Johan Wikman
a2daacd465 Cache: Add options for choose sharing mode
Now possible to use same cache for all threads or separate cache
for each.
2016-11-29 11:23:23 +02:00
Johan Wikman
933e09d245 Cache: Add per thread Cache
The per thread cache is implemented so that there is one single
thread cache per thread.

This uses shared_ptr, which is available in different places
depending on which GCC version is default on the target platform.
So, before this is merged to develop, that needs to be sorted out.
2016-11-29 11:23:23 +02:00
Johan Wikman
910a349f86 Cache: Store name as string and not as char* 2016-11-29 11:23:23 +02:00
Johan Wikman
4f1f71a05a Cache: Make config and storage factory sharable
In antecipation of a CachePT (cache per thread), rearrange things
so that the storage factory and config can be shared between cache
instances.
2016-11-29 11:23:23 +02:00
Johan Wikman
c3319b24a6 Cache: Wrongly protected methods made public 2016-11-29 11:23:23 +02:00
Johan Wikman
124453b756 Cache: Add simple cache
A simple cache is one that does not transparently use multiple
storages in the background. That will be the case when a separate
cache per thread is used. Both CacheST and CacheMT are now derived
from CacheSimple.

A fair amount of what used to be in Cache has now been moved to
CacheSimple. What remains is what surely is common for all cache
types.
2016-11-29 11:23:23 +02:00
Johan Wikman
5bae5b8b8d Cache: Add cache for single thread 2016-11-29 11:23:23 +02:00
Johan Wikman
279bf7e2fa Cache: Change key from char ptr to struct 2016-11-29 11:23:23 +02:00
Johan Wikman
c1c447985d Cache: Make it possible to specify thread model for storage 2016-11-29 11:23:23 +02:00
Johan Wikman
7a0d6307fe Cache: Make Cache abstract
The methods that need to be different depending on the thread model
are now pure virtual.
2016-11-29 11:23:23 +02:00
MassimilianoPinto
440cf9ae7c Merge branch 'develop' into binlog_server_waitdata_encryption 2016-11-28 19:06:22 +01:00
Markus Makela
691989ff04 Split the service header into internal and external parts
The service header in include/maxscale/ contains the public part of the
service API. These functions can be safely used by the modules.

The internal header located in service/core/maxscale/ is used by the core
to initialize MaxScale at startup or to provide other services in a more
controlled way (the config_runtime, for example).
2016-11-28 14:37:26 +02:00
Markus Makela
88677946f8 Add destruction of listeners
The listeners aren't really destroyed and are only stopped. Further
changes are required so that they won't be started again once they have
been destroyed.
2016-11-28 14:37:26 +02:00
Markus Makela
6ea4e50f2c Clean up service.h
Most of the service header functions now contain the relevant
documentation. Cleaned up small parts of it and renamed functions to be
more consistent.
2016-11-28 14:37:26 +02:00
MassimilianoPinto
bf07eb0582 Binlog server encrypts binary logs with AES key and AES_CTR algorithm
First implementation of Binlog server binary encryption

Limitations:
AES_CTR only is supported
events larger than 16MBytes are not encrypted.

Maxscale binary log files can be read by a MaraDB 10.1 server which set
same AES key and algorithm
2016-11-28 11:35:06 +01:00
Johan Wikman
ff3173d588 Cache: Remove obsolete method 2016-11-25 13:44:41 +02:00
Johan Wikman
68f70ee5b2 Cache: Prepare for ST, MT, and PT caches
With a small cost it is possible to prepare for a single-thread,
multi-thread and cache-per-thread specific cases.
2016-11-25 13:03:48 +02:00
Johan Wikman
a71d1f0877 Cache: Param processing moved to cachefilter.cc
This in antecipation of different Cache instances being created
depending on passed arguments.
2016-11-25 11:08:36 +02:00
Johan Wikman
f8f0ef8d34 Cache: Ensure no C++ exceptions can escape 2016-11-25 09:32:35 +02:00
Johan Wikman
14c8a5bb5f Cache: Take Cache class into use
Now the basic structure is in place:

- cachefilter.cc is the MaxScale filter interface.
- Cache is the actual cache class that will also handle LRU issues.
- SessionCache (sessioncache.cc) is the session specific cache class
  that using Cache acts as the cache for a particular session.
  If an item is stale, then one SessionCache will update it.
- StorageFactory is the component that is capable of loading a module
  providing storage facilities.
- Storage is the actual key/value store.
2016-11-25 09:32:35 +02:00
Johan Wikman
719cffd596 Cache: Add Cache class.
This class provides the cache function used by the session caches.

Not taken into use yet.
2016-11-25 09:32:35 +02:00
Johan Wikman
5a6c4b5970 Cache: Take SessionCache into use 2016-11-25 09:32:35 +02:00
Johan Wikman
b5022e1deb Add SessionCache
SessionCache abstracts the cache for a specific session. It then
uses the actual Cache instance for storing data.

It is not used yet.
2016-11-25 09:32:35 +02:00
Johan Wikman
10deb9f07b Cache: Introduce StorageFactory and Storage
The storage module is abstracted with StorageFactory that is capable
of creating Storage instances. The latter contains the data and
provides the behaviour for using the actual storage implementation,
which sits behing a C API, conveniently.
2016-11-25 09:32:35 +02:00
Johan Wikman
762da5f2df Cache: Make everything C++ and rename some files 2016-11-25 09:32:35 +02:00
Johan Wikman
ff405a4f5f Cache compiled as C++
Cache compiled as C++ in order to allow the use of standard
C++ data structures.
2016-11-25 09:32:35 +02:00
Markus Makela
dd63253261 Fix internal test suite failures
The server test used the wrong name.

MySQL users test loaded multiple modules in one function call and wasn't
appropriate for an internal test suite test as it requires a working
installation.

The cache filter didn't set the library paths before trying to load
modules.

The binlogrouter was missing a NULL check which caused a crash.
2016-11-24 15:22:55 +02:00
Johan Wikman
265aacaf15 GWBUF_DATA(...) explicitly returns uint8_t* 2016-11-24 13:31:29 +02:00
Markus Makela
4730e28ef7 Add creation of listeners to maxadmin
Maxadmin now supports the runtime creation of listeners. The new 'default'
value can be used to signal values that don't need to be configured and
the default value should be used.
2016-11-24 10:29:04 +02:00
Markus Makela
67c443fb51 Fix maxadmin argument processing
The arguments were limited to a hard-coded value which wasn't what the
MAXARGS define stated.
2016-11-24 10:29:04 +02:00
Markus Makela
498395cd3d Add monitor alteration to config_runtime.h
Moved the monitor alteration to config_runtime.c.
2016-11-24 10:29:04 +02:00
Markus Makela
e75a27e8db Add server alteration to config_runtime.h
Moved the alteration of servers done in debugcmd.c to config_runtime.c and
altered them to be better suited as API functions.
2016-11-24 10:29:04 +02:00
Markus Makela
8ef99c9066 Move configuration changes to a common file
The config_runtime.h header contains functions that can be used to
manipulate the running configuration. Currently the header contains the
function to create, add, remove and destroy servers.
2016-11-24 10:29:04 +02:00
Johan Wikman
9d3e5a715b Cache: Remove item if putting fails
If an item cannot be put to the database, it is explicitly removed
to ensure that we cannot have the situation that a stale item is
continuously returned because the updating of the value fails for
whatever reason.
2016-11-23 12:15:58 +02:00
Johan Wikman
e9029b183e Cache: Allow entries to be explicitly deleted 2016-11-23 12:15:58 +02:00
Johan Wikman
2ecd5f3340 Prevent stale item from being fetched more than once
If a cached entry becomes stale, then if no extra measures are
taken then every thread hitting that item while it is being fetched
from the server will also refresh it, even though it obviously is
sufficient that one does it.

Now the knowledge that the item is being refreshed is recorded,
so that all other clients are simply returned the stale item. That
way, we'll hit the server once per stale item.
2016-11-23 12:15:58 +02:00
Markus Makela
f4e3ca2c87 Merge branch '2.0.2' into develop 2016-11-23 11:24:34 +02:00
Markus Makela
53413a3260 MXS-929: Add reloading of rules to dbfwfilter
The rules and users are stored in thread-local pointers which removes the
need to hold global locks. This allows greater scalability but causes a
slightly larger memory footprint. Usually the increase in memory
consumption is trivial compared to the benefits in scaling.

Using a per-thread rule and user list allows changes to be applied
immediately without locking on the instance level.

The updating of the rules uses the new functinality described in the
debugcmd.h header. The module registers two functions at startup; one for
reloading rules and one for printing them. These custom functions can be
seen in the `maxadmin list functions` output.
2016-11-23 11:14:31 +02:00
Markus Makela
0a7d1390b6 MXS-929: Add module command calls to maxadmin
The maxadmin interface now supports calls to registered module
functions. It is also capable of listing all the registered functions.
2016-11-23 11:14:31 +02:00