6184 Commits

Author SHA1 Message Date
Johan Wikman
9c1b9c188e Cache: Enable LRU eviction
The maximum count and maximum size of the cache can now be
specified and a storage can declare what capabilities it has.
If a storage modile cannot enforce the maximum count or maximum
size limits, the storage is decorated with an LRU storage that
can.
2016-11-30 10:22:53 +02:00
Johan Wikman
e597523c47 Cache: Allow storage modules to specify capabilites
Will be used to decide whether a LRUStorage facade is needed in front
of the actual storage or not.
2016-11-30 10:22:53 +02:00
Johan Wikman
1701979696 Cache: Add LRU storage
The LRUStorage hierarchy implements the decorator pattern and
is capable of providing LRU behaviour to any underlying storage.
There are two concrete classes - LRUStorageST and LRUStorageMT -
that can be used in single thread and multiple thread contentx,
respectively.

Also tests the convention of placing _ as suffix on member
variables.
2016-11-30 10:22:53 +02:00
Markus Makela
07c602d81c Add creation and destruction of monitors
Monitors can now be created and destroyed at runtime. The configurations
for new monitors are persisted to disk.
2016-11-29 15:04:19 +02: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
Markus Makela
c01430e3fc Fix module commands with no arguments
Passing zero as the argument count would lead to a malloc for zero
bytes which would always cause a failure.
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
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
Markus Makela
3ba8525063 Remove old .gitignore files
The files were used to deal with old Makefile builds.
2016-11-28 14:37:26 +02: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
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
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
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
Johan Wikman
04753bbb76 Make MODULE_INFO const correct 2016-11-24 13:11:03 +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
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
Markus Makela
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
Markus Makela
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
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
Markus Makela
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