Commit Graph

6342 Commits

Author SHA1 Message Date
c1c447985d Cache: Make it possible to specify thread model for storage 2016-11-29 11:23:23 +02:00
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
9362954e82 Add newlines to avrorouter JSON output
JSON does not have a concept of streams and a common way to stream JSON is
to separate each JSON object with a newline. Adding a newline makes it
easier to parse as JSON values do not natively contain newlines.
2016-11-29 00:53:38 +02:00
440cf9ae7c Merge branch 'develop' into binlog_server_waitdata_encryption 2016-11-28 19:06:22 +01:00
3ba8525063 Remove old .gitignore files
The files were used to deal with old Makefile builds.
2016-11-28 14:37:26 +02:00
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
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
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
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
2fe13719bc MXS-1027: Add Upstart config file
Various older systems use Upstart to control services. MaxScale should
provide both init.d scripts and Upstart configurations for systems that
don't support systemd.
2016-11-28 10:48:54 +02:00
cb93db4647 Make a copy of the client request
If the request isn't copied, the buffer will be freed twice.
2016-11-25 23:19:29 +02:00
ff3173d588 Cache: Remove obsolete method 2016-11-25 13:44:41 +02:00
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
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
f8f0ef8d34 Cache: Ensure no C++ exceptions can escape 2016-11-25 09:32:35 +02:00
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
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
5a6c4b5970 Cache: Take SessionCache into use 2016-11-25 09:32:35 +02:00
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
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
762da5f2df Cache: Make everything C++ and rename some files 2016-11-25 09:32:35 +02:00
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
e31afa28e4 Serialize created listeners to disk
The created listeners are now stored to disk like created servers
are. This allows them to be used even after a restart.

Currently, the listeners cannot be deleted and need to be manually
removed.
2016-11-24 15:22:55 +02:00
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
265aacaf15 GWBUF_DATA(...) explicitly returns uint8_t* 2016-11-24 13:31:29 +02:00
04753bbb76 Make MODULE_INFO const correct 2016-11-24 13:11:03 +02:00
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
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
e8af6908c1 Allow creation of listener at runtime
Listeners can now be created and started at runtime. If SSL is to be used,
the required parameters must be present.
2016-11-24 10:29:04 +02:00
b24a28285c Make listener creation const-correct
The parameters passed to functions that create new listeners are now of
type const char*.
2016-11-24 10:29:04 +02:00
ff54771cd1 Store old server SSL configurations
If the SSL configuration of a server was altered successfully, it would
overwrite an existing configuration leading to a true memory
leak. Converting the SSL_LISTENER structure to a list allows it to store
the old configurations without leaking the memory.

This has no functional benefits apart from storing references which could
aid in debugging. In the future, the discarded configurations could be
freed once all connections that use it are closed.
2016-11-24 10:29:04 +02:00
498395cd3d Add monitor alteration to config_runtime.h
Moved the monitor alteration to config_runtime.c.
2016-11-24 10:29:04 +02:00
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
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
d309444540 Add module command documetation
Added a document that describes the module command system and added the
necessary information in the dbfwfilter documentation.

The release notes also point to the newly created document.
2016-11-24 09:28:12 +02:00
221f2f79f0 Only call destroyInstance for valid instances
If the router of filter failed to create an instance, destroyInstance
should not be called.
2016-11-24 02:49:08 +02:00
d9642dd5ae MXS-1025: All logging now behing the log_level
Earlier a successful parsing but failure to classify was always
logged.
2016-11-23 14:47:24 +02:00
35620f8dae Build compare using embedded library
For whatever reason compare fails to load qc_mysqlembedded if
it has not been built with the embedded library. Needs to be
sorted out at some point.
2016-11-23 14:35:46 +02:00
6d1265ade1 Length of a packet requires 32 bit. 2016-11-23 13:53:06 +02:00
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
e9029b183e Cache: Allow entries to be explicitly deleted 2016-11-23 12:15:58 +02:00
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
f4e3ca2c87 Merge branch '2.0.2' into develop 2016-11-23 11:24:34 +02:00
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
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
502eba8b4f Fix OK packet generation
The packet was generated with the wrong number of elements due to usage of
sizeof on an integer where the correct type was an uint8_t.

This only fixes the malformed packets but does not fix the root cause of
the problem. The affected rows and last insert ID are length encoded
integers which should be handled. The current code treats them as one byte
fields.
2016-11-23 10:37:42 +02:00
83ffdcf4ed Change defines into inline functions
To prevent bugs caused by pointers having the wrong type (e.g. uint32_t
instead of uint8_t), some macros are changed into inline functions so that
the normal type-checking is performed.

The macros MYSQL_GET_ERRCODE, MYSQL_GET_STMTOK_NPARAM, MYSQL_GET_STMTOK_NATTR,
and MYSQL_GET_NATTR were not changed, because they may be too specific to
be present in a general purpose header in the first place.
2016-11-23 10:14:50 +02:00
dcd98900ea Remove dependency on embedded library
The test programs of the query classifier do not need the
embedded library headers.
2016-11-23 10:14:50 +02:00
1457b88606 Fix transaction tracking
The transaction tracking functionality used the wrong pointer type for
buffer data. This caused the query command comparison to always fail.
2016-11-23 10:11:27 +02:00
8572eb34a0 qc_sqlite: Dequote more properly
When a backslash is encountered, the backslash should not be
copied but only the character after that.

For the sake of completeness, a few more characters would have
to be handled explicitly, but as the content of a string will not
affect the statement's classification there is not much point in
doing that.
2016-11-22 19:11:21 +02:00